Solved

Map

Posted on 2006-10-23
1
205 Views
Last Modified: 2013-11-20
map<int, double>::iterator iterator = anumbermap.end();
iterator--;
double d = (iterator--)->second;

Is there a more elegant method for retriving the elements at two places from the end? Something like:
iterator -=  2
double d = iterator->second;
0
Comment
Question by:XPUSR
1 Comment
 
LVL 5

Accepted Solution

by:
Alkali_Guy earned 50 total points
ID: 17793552
No, ++ and -- are the only overloads for this purpose.  The best you can do is:

for (char i=0;i<2;i++) iterator--;
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now