I have some class called Order. For some reason, the following code won't compile while using rbegin(), but it works for begin(). Is there a problem in the way I'm declaring the iterator or perhaps a problem with my pointer reference?
map<double, list<Order*>> m
typedef map<double, list<Order*>>::iterator iter;
iter iterator;
iterator = m.rbegin(); // this only works for m.begin()
Thank you!
rbegin() returns a reverse_iterator, not an iterator.
The types returned from begin() and rbegin() are different:
begin() returns std::map<K, V>::iteratorrbegin() returns std::reverse_iterator<std::map<K, V>::iterator>If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With