Neal Becker wrote:
Interesting. This example, which I think is equivalent to yours, compiles fine with gcc-4.4.1:
It's a runtime error. i686-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:162: error: attempt to copy from a singular iterator. Objects involved in the operation: iterator "this" @ 0x0xbffff5f8 { type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPdN10__gnu_norm6vectorIdSaIdEEEEEN15__gnu_debug_def6vectorIdS6_EEEE (mutable iterator); state = singular; } iterator "other" @ 0x0xbffff62c { type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPdN10__gnu_norm6vectorIdSaIdEEEEEN15__gnu_debug_def6vectorIdS6_EEEE (mutable iterator); state = singular; }