Solved

Map

Posted on 2006-10-23
1
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a Shell script to start a service checking the port 6 56
Login Script to Copy Folders 12 50
sameEnds challenge 3 196
lucky13 challenge 11 167
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Suggested Courses

738 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