Re: [Mingw-users] set iterators are const always
- Date: Wed, 06 Feb 2008 17:03:04 +0000
- From: Greg Chicares <gchicares@xxxxxxxxxxxxx>
- Subject: Re: [Mingw-users] set iterators are const always
[reformatted--please wrap lines to a width of about seventy]
On 2008-02-06 16:09Z, Matthias Böhm wrote:
> I'm using mingw 5.1.3, gcc 3.4.5 and with the following file,
> i get compiling errors which do not occur with other compilers:
Which other compilers, and which STL implementations do they use?
Many other implementations are more lax. See below for a compiler
that's trustworthy (though I'm not sure which STL it's using).
> set<X, less_X>::iterator it;
>
> for(it = xset.begin(); it != xset.end(); it++) {
> it->do_something_non_const(); // produces compiler error
> }
[...]
> In mingw, that won't compile, because the compiler complains
> that the object the iterator is pointing to is constant:
http://www.comeaucomputing.com/tryitout/
error: the object has cv-qualifiers that are not
compatible with the member function
object type is: const X
it->do_something_non_const(); // produces compiler error
^
> But i'm using iterator, not const_iterator!!!
Yet you're using std::set, so iterators aren't modifiable:
http://groups.google.com/group/comp.lang.c++.moderated/msg/c2440d4029121ccf
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users