Top "Const-iterator" questions

A C++ STL iterator with strictly read-only access.

How to correctly implement custom iterators and const_iterators?

I have a custom container class for which I'd like to write the iterator and const_iterator classes. I never …

c++ iterator const-iterator
How to implement an STL-style iterator and avoid common pitfalls?

I made a collection for which I want to provide an STL-style, random-access iterator. I was searching around for an …

c++ iterator const-iterator
what is the difference between const_iterator and iterator?

What is difference between these two regarding implementation inside STL. what is the difference regarding performance? I guess when we …

c++ stl iterator const-iterator
What is the reason behind cbegin/cend?

I wonder why cbegin and cend were introduced in C++11? What are cases when calling these methods makes a difference …

c++ c++11 iterator const-correctness const-iterator
Iterate over vector of pair

I have written following code snippet but it does not seem to be working. int main(){ int VCount, v1, v2; …

c++ vector stl iterator const-iterator
How to remove constness of const_iterator?

As an extension to this question Are const_iterators faster?, I have another question on const_iterators. How to remove …

c++ stl iterator const-iterator
C++ iterator to const_iterator

How do I acquire a const_iterator (of some container class) from an iterator (of that container class) in C++? …

c++ stl iterator containers const-iterator
Are const_iterators faster?

Our coding guidelines prefer const_iterator, because they are a little faster compared to a normal iterator. It seems like …

c++ stl iterator const-iterator
Should I prefer iterators over const_iterators?

Someone here recently brought up the article from Scott Meyers that says: Prefer iterators over const_iterators (pdf link). Someone …

c++ stl iterator const-iterator
C++ iterator and const_iterator problem for own container class

I'm writing an own container class and have run into a problem I can't get my head around. Here's the …

c++ stl containers const-iterator