[英]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中找到的右值引用参数构造函数在类定义中看起来像这样:
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.