[RFC] std::string(0);

Jonathan Wakely cow@compsoc.man.ac.uk
Mon Jun 14 19:18:00 GMT 2004


On Mon, Jun 14, 2004 at 10:44:27PM +0530, Dhruv Matani wrote:

> BTW, how does gcc specifically handle the case say when you apply
> &*end() to en empty default constructed vector?

Until the capacity is > 0 it returns a null pointer.

In debug mode it throws:

/home/redi/gcc/3.4/lib/gcc/x86_64-unknown-linux-gnu/3.4.1/../../../../include/c++/3.4.1/debug/safe_iterator.h:178:
    error: attempt to dereference a past-the-end iterator.

Objects involved in the operation:
iterator "this" @ 0x0x7fbfffda40 {
type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPiN10__gnu_norm6vectorIiSaIiEEEEEN15__gnu_debug_def6vectorIiS6_EEEE (mutable iterator);
  state = past-the-end;
  references sequence with type `N15__gnu_debug_def6vectorIiSaIiEEE' @ 0x0x7fbfffda40
}
Aborted




More information about the Libstdc++ mailing list