Is std::string ref-counted in GCC 4.x / C++11?

前端 未结 3 1479
别跟我提以往
别跟我提以往 2020-11-27 06:49

Is std::string reference-counted when using gcc 4 with -std=c++0x or -std=c++11?

3条回答
  •  粉色の甜心
    2020-11-27 07:25

    Adding some useful information that post-dates this question.

    std::string will no longer be reference-counted with the release of GCC 5, to address this C++11 requirement.

    From https://gcc.gnu.org/gcc-5/changes.html

    A new implementation of std::string is enabled by default, using the small string optimization instead of copy-on-write reference counting.

提交回复
热议问题