Topic: why are multiset iterators not mutable?
Author: phalpern@newview.org (Pablo Halpern)
Date: 1999/11/27 Raw View
Jean-Denis <jdmv@NEVERSPAMmail.com> wrote:
>Hi, I recently wanted to use multiset to hold a bunch of objects, and then to
>iterate over it to call a member function which changes the object's state.
This is a duplicate thread. (You posted the same question twice.) I
suggest you look at the thread titled "STL: Why no mutable set/multiset
iterator?", where there is some good discussion on this topic.
---------------------------------------------------------------
Pablo Halpern phalpern@newview.org
Check out my new book, The C++ Standard Library from Scratch at
http://www.halpernwightsoftware.com/stdlib-scratch
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Jean-Denis <jdmv@NEVERSPAMmail.com>
Date: 1999/11/19 Raw View
Hi, I recently wanted to use multiset to hold a bunch of objects, and then to
iterate over it to call a member function which changes the object's state.
My compiler complains of a const violation, which I understand: it is
documented that set and multiset iterators are actually const iterators.
My question is why? I kind of suspect for set, that it is because the set
only contains a copy one object (but even then, why not let the programmer
take his responsabilities?). For multiset, I really don't understand the
limitation.
Thank you for your help.
Jean-Denis Muys-Vasovic
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Tom" <rhinoceros1@hotmail.com>
Date: 1999/11/19 Raw View
By coincidence the same thing came up for me today. Someone pointed me to
here:
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#103
Jean-Denis <jdmv@NEVERSPAMmail.com> wrote in message
news:01HW.B459252B022AF31F07C145DC@news.cybercable.fr...
> Hi, I recently wanted to use multiset to hold a bunch of objects, and then
to
> iterate over it to call a member function which changes the object's
state.
>
> My compiler complains of a const violation, which I understand: it is
> documented that set and multiset iterators are actually const iterators.
>
> My question is why? I kind of suspect for set, that it is because the set
> only contains a copy one object (but even then, why not let the programmer
> take his responsabilities?). For multiset, I really don't understand the
> limitation.
>
> Thank you for your help.
>
> Jean-Denis Muys-Vasovic
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]