std :: string - 小字符串优化和交换 [英] std::string — small string optimization and swap
问题描述
从N3290,[container.requirements.general]:
From N3290, [container.requirements.general]:
表达式
a.swap(b)
,对于除array
之外的标准容器类型的容器a和b,应交换a和b的值而不调用任何移动,
The expression
a.swap(b)
, for containers a and b of a standard container type other thanarray
, shall exchange the values of a and b without invoking any move, copy, or swap operations on the individual container elements.
如何与小字符串优化进行交互?他们是否忘记添加 std :: string
?
How do this interact with small string optimization? Did they forget to add std::string
too?
推荐答案
重新发布评论)
std :: string
不是容器–在$ FDIS的 Containers library
章节(§23)中没有描述 basic_string
的事实是一个很好的线索。 ; - ]
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. ;-]
这篇关于std :: string - 小字符串优化和交换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!