Solved

Map

Posted on 2006-10-23
1
193 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

20 Experts available now in Live!

Get 1:1 Help Now