std :: string - 小字符串优化和交换 [英] std::string — small string optimization and swap

查看:123
本文介绍了std :: string - 小字符串优化和交换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从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 than array, 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆