With stl::vector:
vector v(1);
v[0]=1; // No bounds checking
v.at(0)=1; // Bounds checking
Is there a way to disable bounds checking
Use at() when you always want checking. Also note that this throws an exception on error, so it is potentially recoverable. If you want the faster, unchecked, accessor, use [], but algorithms that use this should be tested thoroughly because the failure mode is more severe (undefined behavior).
A couple of approaches to development-mode bounds checking for []
when using GCC on Linux:
Enable GCC debug mode, see also GCC STL bound checking
-D_GLIBCXX_DEBUG
Run your program under the Valgrind memory checker
valgrind (your program and args)
Some other interesting discussion: vector::at vs. vector::operator[]