On Sat, 19 Jan 2013, Paul Pluzhnikov wrote: > This patch adds lightweight checks for front()/back() on empty vector.
> front() > - { return *begin(); } > + { > +#if __google_stl_debug_vector > + if (empty()) __throw_logic_error("begin() on empty vector"); Isn't the error message wrong, then? begin() on an empty vector is perfectly fine, isn't it? *begin() is the problem here, so should this say if (empty()) __throw_logic_error("front() on empty vector"); instead? > +#if __google_stl_debug_vector > + if (empty()) __throw_logic_error("back() on empty vector"); > +#endif In the symmetric case you're already using back(), not end(). Gerald