How do I capture by move (also known as rvalue reference) in a C++11 lambda?
I am trying to write something like this:
std::unique_ptr<int> myPointer(new int);
std::function<void(void)> example = [std::move(myPointer)]{
*myPointer = 4;
};
How do I capture by move (also known as rvalue reference) in a C++11 lambda?
I am trying to write something like this:
std::unique_ptr<int> myPointer(new int);
std::function<void(void)> example = [std::move(myPointer)]{
*myPointer = 4;
};