Default capacity of std::string?

前端 未结 5 1392
灰色年华
灰色年华 2020-12-20 14:22

When I create a std::string using the default constructor, is ANY memory allocated on the heap? I\'m hoping the answer does not depend on the implementation and

5条回答
  •  醉酒成梦
    2020-12-20 15:08

    It depends on the compiler. Take a look here, there is a good explanation:

    http://www.learncpp.com/cpp-tutorial/17-3-stdstring-length-and-capacity/

提交回复
热议问题