next item Vector and Map

Hello everybody,

How can I get the next and previous items in a Vector or a Map?

for example, if I have a map like this :
1
2
3
4
5
6
7

    RateCurve["1D"  ]=4.77  ;
    RateCurve["1W"  ]=4.773 ;
    RateCurve["1M"  ]=4.773 ;
    RateCurve["2M"  ]=4.753 ;
    RateCurve["3M"  ]=4.733 ;


and I specify the key "1M", i want to get the next key which is "2M" and the previous one "1W" ?

the same in the case of a 2D vector (which looks like this map)

thank you!!
For the posted map:

1
2
3
4
5
6
7
std::map<std::string,double>::iterator i = RateCurve.begin(); // iterator to first item, "1D"

++i; // iterator moved to "1W"

i = RateCurve.find("1M"); // iterator to item with key "1M" (or if not found, Ratecurve.end())

--i; // iterator moved back to  "1W"; 

Topic archived. No new replies allowed.