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

前端 未结 5 2148
小鲜肉
小鲜肉 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:49

    Enable the flag _GLIBCXX_DEBUG to do bounds checking on STL containers, as discussed here: http://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode.html

提交回复
热议问题