如何通过C++ 11 lambda中的move(也称为右值引用)捕获?
我想写这样的东西:
std::unique_ptr<int> myPointer(new int);
std::function<void(void)> example = [std::move(myPointer)]{
*myPointer = 4;
};
Run Code Online (Sandbox Code Playgroud) 我的编译器不支持make_unique.怎么写一个?
template< class T, class... Args > unique_ptr<T> make_unique( Args&&... args );
Run Code Online (Sandbox Code Playgroud)