Boost logo

Boost :

From: Jesse Jones (jejones_at_[hidden])
Date: 2000-12-15 18:25:06

>From: Jesse Jones [mailto:jejones_at_[hidden]]
>> >I notice that bounds checking in array.hpp is only done when the at()
>> >methods are used. I think it would be a great boon to the community
>> >using boost if there could be a debug mode -- either use asserts or,
>> >as the STLPort does, have a boost_debug namespace and do range
>> >checking for classes imported from there. Does this make sense?
>> Most definitely.
>This is standard for all STL containers. The at() form does bounds checking,
>and the operator[] form is fast and does not. While I don't object in
>principle to a "debug mode" flag which makes operator[] the same as at(), I
>am happy with things as they stand. I would object if the "release" mode
>differed from the established practice in the standard library.

The standard says that at() must throw if the precondition is violated and
that the behavior of operator[] is undefined. It's true that most vendors
do a poor job of catching precondition violations, but there's no reason
for boost to go along with this. I strongly support liberal usage of
assertions in boost.

  -- Jesse

Boost list run by bdawes at, gregod at, cpdaniel at, john at