Someone here recently brought up the article from Scott Meyers that says:
- Prefer
iterators
over const_iterators
(pdf link).
Someone else was commenting that the article is probably outdated. I'm wondering what your opinions are?
Here is mine: One of the main points of the article is that you cannot erase or insert on a const_iterator
, but I think it's funny to use that as an argument against const_iterators
. I thought the whole point of const_iterators
it that you do not modify the range at all, neither the elements themselves by substituting their values nor the range by inserting or erasing. Or am I missing something?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…