Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 c++ STL 中,如果我有一个指向it向量的迭代器v,则it - v.begin()保证会给我指向向量的索引,这样*it == v[it - v.begin()]呢?如果是这样,所有随机访问迭代器都是这样吗?
it
v
it - v.begin()
*it == v[it - v.begin()]
是的,对所有 RA 迭代器都是如此。