简体   繁体   English

std :: basic_string是否正式具有隐式生成的move构造函数?

[英]Does std::basic_string formally have an implicitly generated move constructor?

I'm aware that std::basic_string in practice supports move semantics, but the rvalue reference argument constructor I find in C++11 looks like this in the class definition: 我知道std::basic_string实际上支持移动语义,但是我在C ++ 11中找到的右值引用参数构造函数在类定义中看起来像这样:

C++11 §21.4/5 : C ++ 11§21.4/ 5
 basic_string(basic_string&&, const Allocator&); 

Then in the detailed discussion it's again shown without a default for the allocator argument: 然后,在详细的讨论中,它再次显示为allocator参数没有默认值:

C++11 §21.4.2/17 : C ++ 11§21.4.2/ 17
 basic_string(basic_string&& str, const Allocator& alloc); 

Disregarding obvious intent that the class should be movable, does the class then formally have an implicitly generated move constructor? 忽略该类应为可移动类的明显意图,该类是否正式具有隐式生成的move构造函数?

No, it's not implicit, but explicit. 不,它不是隐式的,而是显式的。 Also in C++11 21.4/5 is 同样在C ++ 11 21.4 / 5中是

basic_string(basic_string&& str) noexcept;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 std :: basic_string构造函数如何预先知道要保留多少空间? - How does the std::basic_string constructor know beforehand how much space to reserve? basic_string类确实具有带多个参数的复制构造函数,还是仅仅是构造函数? - Does basic_string class really have copy constructor that takes more than one parameter or is it just constructor? std :: basic_string的使用 - Uses of std::basic_string std::basic_string 特化 - std::basic_string specialization 编译错误 - 多个构造函数实例 "std::basic_string&lt;_Elem, _Traits, _Alloc&gt;::basic_string - Compilation error - more than one instance of constructor "std::basic_string<_Elem, _Traits, _Alloc>::basic_string 为什么 std::basic_string 有两个独立的模板参数 _Elem (char type) 和 _Traits (char traits)? - Why does std::basic_string have two separate template parameters _Elem (char type) and _Traits (char traits)? move构造函数是否必须调用std :: move()? - Does move constructor have to call std::move()? boost :: interprocess :: basic_string as std :: string - boost::interprocess::basic_string as std::string 转换 std::basic_string<Char> 串起来 - Convert std::basic_string<Char> to string std :: basic_string :: reserve()的详细信息 - std::basic_string::reserve() specifics
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM