This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Why does vector<>::at() throw range_error?



Looks like a bug. Try this.

2000-01-24  Benjamin Kosnik  <bkoz@gnu.org>
            via <llewelly@198.dsl.xmission.com>

	* stl/bits/stl_vector.h (vector::_M_range_check): Throw
	out_of_range instead of range_error.

Index: stl_vector.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/stl/bits/stl_vector.h,v
retrieving revision 1.14
diff -u -p -c -p -r1.14 stl_vector.h
cvs server: conflicting specifications of output style
*** stl_vector.h	1999/11/10 00:47:51	1.14
--- stl_vector.h	2000/01/25 01:38:41
*************** public:
*** 223,229 ****
  #ifdef __STL_THROW_RANGE_ERRORS
    void _M_range_check(size_type __n) const {
      if (__n >= this->size())
!       __stl_throw_range_error("vector");
    }
  
    reference at(size_type __n)
--- 223,229 ----
  #ifdef __STL_THROW_RANGE_ERRORS
    void _M_range_check(size_type __n) const {
      if (__n >= this->size())
!       __out_of_range("vector");
    }
  
    reference at(size_type __n)




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]