vector::at
are quite helpful for boundary checking, but will lead to low speed.
So I am wondering whether there is a way to quickly convert code between vector::operator[]
and vector::at
, so that one for release and one for debug.
Like
If (DEBUG)
{
// Do with .at
}
else
{
// Do with []
}
However, using code like that will import risk that when Do with .at
are changed, Do with []
are forgotten to be changed accordingly.
Is there a quick way to convert code between two modes?