Tag
Move Switch
Switch to force move.
Include Headers
seqan/basic.h
Remarks
The difference between move constructor and copy constructor
is that the source object is not copied but moved into the target object.
The source object can lose its content and will be empty after
this operation in this case.
A move constructor can sigificantly faster than a copy constructor.
Tags
Move instead of assign. |
Examples
String target(source, Move()); // source is moved to target
std::cout << source; //nothing printed since source lost content
std::cout << target; //"hello"
Move constructors are like copy-constructors. However, their argument is not const.
{
public:
seqan::String m;
// Copy constructor, other is left untouched.
Klass(Klass const & other) { ... }
// Move constructor, leaves other and its members in an "empty" state.
Klass(Klass & other, seqan::Move const &) { ... }
};
See Also
SeqAn - Sequence Analysis Library - www.seqan.de