First of all I apologize for the long lead up to such a simplistic question.
I am implementing a class which serves as a very long 1 dimensional index on a space fil
The easiest solution is to do as C++ itself does. This limits the amount of surprises that your users will experience.
C++ itself is fairly consistent. Both the built-in []
on pointers and std::vector::operator[]
have undefined behavior if you use an out-of-bound array index. If you want bounds checking, be explicit and use std::vector::at
Hence, if you do the same for your class, you can document the out-of-bound behavior as "standard".