folly::MoveWrapper

C++11 closures don't support move-in capture. Nor does std::bind. facepalm.

Synopsis

Declared in <folly/MoveWrapper.h>

template<class T>
class MoveWrapper;

Description

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3610.html

"[...]a work-around that should make people's stomach crawl: write a wrapper that performs move-on-copy, much like the deprecated auto_ptr"

Unlike auto_ptr, this doesn't require a heap allocation.

Member Functions

NameDescription
MoveWrapper [constructor]Constructors
operator= Assignment operators
move move the value out (sugar for std::move(*moveWrapper))
operator* Access the wrapped value.
operator-> Access members of the wrapped value.

Non-Member Functions

NameDescription
makeMoveWrapperMake a MoveWrapper from the argument. Because the name "makeMoveWrapper" is already quite transparent in its intent, this will work for lvalues as if you had wrapped them in std::move.