With stl::vector:
vector<int> v(1);
v[0]=1; // No bounds checking
v.at(0)=1; // Bounds checking
Is there a way to disable bounds checking without having to rewrite all at()
as []
? I am using the GNU Standard C++ Library.
Edit: I changed at()
to []
in the area where I suspected a bottleneck, and it significantly reduced the computation time. However, since I iterate between developing the code and running experiments with it, I would like to enable bounds checking during development and disable it when I run the experiments for real. I guess Andrew's advice is the best solution.
at()
with[]
, and set a breakpoint to help verify that all instances were replaced. Not that one slipping through would be a disaster, the concern is just performance, right? – Neomineomycin[]
. Otherwise, let it be. – Apeakat
s either, just the hotspots. :-P – Andvari