BDE 4.14.0 Production release
|
Provide a non-allocating test class that records when moved from.
This component provides a single, unconstrained, non-allocating (value-semantic) attribute class, MovableTestType
, that records when the move constructor or assignment operator is called with the instance as the source argument. This class is not bitwise-moveable, and will assert on destruction if it has been copied (or moved) without calling a constructor. This class is primarily provided to facilitate testing of templates where move semantics need to be differentiated versus copy semantics.
data
: representation of the object's valuemovedInto
: indicates whether a move constructor or move assignment operator was used to set the value of this object.movedFrom
: indicates whether a move constructor or move assignment operator was used to move out the value of this object.This section illustrates intended use of this component.
Suppose we wanted to print the supported traits of this test type.
First, we create a function template printTypeTraits
with a parameterized TYPE
:
Now, we invoke the printTypeTraits
function template using MovableTestType
as the parameterized TYPE
:
Finally, we observe the console output: