简体   繁体   中英

Iterator arithmetic

In c++ STL, if I have an iterator it into a vector v , is it - v.begin() guaranteed to give me the index into the vector, so that *it == v[it - v.begin()] ? If so, is this true for all random access iterators?

是的,它是,并且所有RA迭代器都是如此。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM