This is the mail archive of the email@example.com mailing list for the libstdc++ project. See the libstdc++ home page for more information.
Chip Salzenberg - a.k.a. - <firstname.lastname@example.org> >According to Ryszard Kabatek: >> I wrote an iterator class for std::vector<> and std::basic_string<>. > >Could someone please fill me in on why that's necessary? I thought >that plain old pointers were adequate iterators in these cases. It's not necessary for conformance, but it _is_ necessary for type-safety. Otherwise any old char* works as an iterator, no matter where it came from. This is evil. At the least, it leads your code to be non-portable, because other string implementations don't use pointers for iterators, so if you misuse pointers got from c_str() or data(), it may work with one implementation but not another. Nathan Myers email@example.com