Using operator[] on empty std::vector

前端 未结 7 921
迷失自我
迷失自我 2021-01-12 05:29

I was advised a while ago that is was common place to use std::vector as exception safe dynamic array in c++ rather than allocating raw arrays... for exampl

7条回答
  •  一生所求
    2021-01-12 06:13

    MVS does range checking in operator[] even in release builds. I don't know if it's standard compliant. (I actually found debug code in their implementation which made their implementation break correct code). There is a switch to disable it though.

提交回复
热议问题