This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project. See the libstdc++ home page for more information.
> > To get that, they must be distinct types so that > > trying to do something that should be illegal can in fact be illegal. > > I think a lot of this ambiguity will be resolved if specific examples > could be generated. Can you provide some code to illustrate things that > "should be illegal" that are permitted in the current implementation? Both > illegalities between raw pointers and iterator classes, and interator to > const_iterator conversions? I would appreciate it. Here is an example for implementations where iterators are really pointers: std::vector<char> v[1]; std::vector<char>::iterator vi = v.begin(); std::string::iterator si = vi; // oops, string iter points into a vector! Here is an example where const_iterator is the same type as iterator: const std::vector<int> v[1]; std::vector<int>::const_iterator cvi = v.const_begin(); std::vector<int>::iterator = cvi; *cvi = 0; // oops, just clobbered a "const" vector! In each case, errors of a type that are normally caught by the type system slip through because the library facility fails to model a builtin type correctly. Nathan Myers ncm@cantrip.org