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()
返回一个reverse_iterator
,而不是一个iterator
。
The types returned from begin()
and rbegin()
are different:
begin()
returns std::map<K, V>::iterator
rbegin()
returns std::reverse_iterator<std::map<K, V>::iterator>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.