This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] std::string(0);
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