Topic: STL sets have mutable iterators?
Author: hough@aai.com (Al Hough)
Date: 1996/01/25 Raw View
In my April 95 copy of the DWP, I couldn't find any requirement
that a set iterator be a const_iterator. Previous STL documentation
required that for sets, an iterator was a const_iterator, thus
insuring that the return type from dereferencing a set<T>::iterator
was a const T& and not a T&. I agreed with the behavior that a
set iterator should yield const T&, because yielding a T& would
allow users to break the "uniqueness" of the set by allowing the
possiblility that a user could modify an existing value in the
set so that it became equal to another value in the set.
What was intended here?
--
Al Hough email: hough@aai.com
Amerinex Artificial Intelligence phone: (413) 256-8941
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]