The Exception::Memory::Range exception is thrown by container classes if
both:
- a subscript operator argument is outside the range [0..container.size()]
- O_RANGE_CHECK is defined at compile time.
are true. For optimization reasons memory range checking is not systematically done. Range
errors should have been properly debugged before final code release.
Synopsis
#include <lyric/Exceptions.hpp>
class Exception::Memory::Range : public Exception::Memory
{
public:
Exception::Memory::Range (Size index, Size size, const void* who);
Exception::Memory::Range (const Exception::Memory::Range& except);
Size index () const;
Size size () const;
};
Description
-
Exception::Memory::Range (Size index, Size size, const void* who) -
Constructs this memory range exception with the offending index, the size the
container can store, and who, the address of the container object who throws
the exception. This constructor is used in all LYRIC containers that do range
checking, if the O_RANGE_CHECK compile flag was enabled.
-
Exception::Memory::Range (const Exception::Memory::Range& except) -
Constructs this exception from the given exception. All properties and data
stored in except are copied into this.
-
Size index () const -
Returns the value of the index that was at the origin of the exception
throwing.
-
Size size () const -
Returns the size of the container who threw the exception. In a LYRIC
container only indexes in the range 0 to size-1 are valid.