Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: C++
Expertise: Intermediate
Oct 18, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

The Semantics of const_iterator

A recent subscriber of one of the C++ newsgroups posted the following question: Why did the C++ standardization committee created a const_iterator instead of a const iterator? Or, at least, why not require const_iterator to actually have type const iterator? The answer is simple: a const_iterator is nota const iterator. This means that you can alter the value of a const_iterator, e.g., increment it using ++. However, you cannot change the element to which a const_iterator points. In other words, if you think of an iterator as a pointer to T, a const_iterator is not a const pointer to T, but rather, it
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date