How to make std::vector's operator[] compile doing bounds checking in DEBUG but not in RELEASE

前端 未结 5 2142
小鲜肉
小鲜肉 2020-11-27 05:55

I\'m using Visual Studio 2008.

I\'m aware that std::vector has bounds checking with the at() function and has undefined behaviour if you try to access something usin

5条回答
  •  半阙折子戏
    2020-11-27 06:38

    C++ defines vector operator[] as not throwing exception for sake of speed.

    I'd advise you to test the application in Debug Configuration for a while till you gain confidence that major "hidden" bugs gone.

提交回复
热议问题