Re: strange crash after assertion with std::map::iterator

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Mycroft Holmes" <m.holmes@xxxxxxxxx> wrote in message
news:eIVybCxhHHA.4976@xxxxxxxxxxxxxxxxxxxx
first, iterators DO contain pointers; I cannot prove it, but I'd bet
it's IMPOSSIBLE to design an iterator without making use of pointers.

Stream iterators are unlikely to contain pointers. Maybe a pointer to
the stream, but definitely not a pointer to T (T being the type of
elements iterated over).

vector::iterator could very well hold an index rather than a pointer.

I don't quite understand how this issue is relevant, though.

second, I never said that a value-initialized iterator should be the
end of anything. I just said it should be a VALID ITERATOR, and I
made clear what I mean by "valid": just equality and inequality
comparable.

Comparable to what? What should be the result of such a comparison?
Perhaps more importantly, _why_ do you want that? In what situation
would you like to be able to use such a facility?

As an aside, note that output iterators aren't required to be equality
comparable at all, singular values or otherwise (C++ standard 24.1.2,
Table 73).
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • Re: Einfache Frage zu STD::SORT
    ... > also iterator ein Pointer auf _Ty ist. ... > Deswegen müßte man die Definition von Prädikat noch präzisieren. ... > Operator) mit dem Datentyp bool besitzt? ...
    (microsoft.public.de.vc)
  • Re: is it possible to pass C++ vectors to fortran subroutines
    ... returns an iterator to the 1st element, but my function prototype is ... You can't pass a C pointer to a C pointer into a standard Fortran ...
    (comp.lang.fortran)
  • Re: Generic linked list with internal storage?
    ... Iterator *it = newIterator; ... how you derive the double pointer with respect to possible alignment ... to write generic code and use that template for any data structure you ... comp.lang.c++ is a group dedicated to your preferred monstruosity. ...
    (comp.lang.c)
  • Re: is it possible to pass C++ vectors to fortran subroutines
    ... returns an iterator to the 1st element, ... You can't pass a C pointer to a C pointer into a standard Fortran ... I'm guessing your C array example used a pointer to the ...
    (comp.lang.fortran)
  • Re: How to convert between iterators and pointers?
    ... Yes, but it's rarely useful. ... > random-access iterator. ... This is NOT talking about converting a pointer to an iterator or vice ... versa -- it's saying that you can use a pointer AS an iterator, ...
    (comp.lang.cpp)