std::string ― small string optimization and swap

匿名 (未验证) 提交于 2019-12-03 01:32:01

问题:

From N3290, [container.requirements.general]:

The expression a.swap(b), for containers a and b of a standard container type other than array, shall exchange the values of a and b without invoking any move, copy, or swap operations on the individual container elements.

How do this interact with small string optimization? Did they forget to add std::string too?

回答1:

(Reposting from comment)

std::string is not a container – the fact that basic_string is not described in the Containers library chapter (§23) of the FDIS is a good clue. ;-]



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!