C++ 概念: MoveConstructible (C++11 起)

来自cppreference.com

指定的类型的一个实例可以移动(移动)建造的。这意味着该类型的移动语义:也就是说,可以将其内部状态的相同类型的新实例,有可能最大限度地减少开销.
Original:
Specifies that an instance of the type can be move-constructed (moved). This means that type has move semantics: that is, can transfer its internal state to a new instance of the same type potentially minimizing the overhead.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 要求

类型必须符合CopyConstructible要求和/或实现以下功能:
Original:
The type must meet CopyConstructible requirements and/or implement the following functions:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Type::Type

Type::Type( Type&& other );

Type::Type( const Type&& other );
Type::Type( volatile Type&& other );

Type::Type( const volatile Type&& other );
(的变种之一就足够了)

移动的构造函数: constructs an instance of a type with the contents of other. The internal state of other is unspecified after the move. However, it must still be valid, that is, no invariants of the type are broken.

The following expressions must have the specified effects:

表达
Original:
Expression
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Effects
Type a = rv;
a相当于rv,其中rv右值引用Type.
Original:
a is equivalent to rv, where rv is a 右值引用 of Type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Type(rv);
Type类型的对象是一个临时相当于rvrv是一个右值引用Type.
Original:
a temporary object of type Type is equivalent to rv, where rv is a 右值引用 of Type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 另请参阅

类型检查,如果有一个移动的构造函数
Original:
checks if a type has a move constructor
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(类模板) [edit]