I am capturing a unique_ptr in a lambda expression this way:
auto str = make_unique(\"my string\");
auto lambda = [ capturedStr = std::move(str)
The operator () of a lambda is const by default, and you can't move from a const object.
Declare it mutable if you want to modify the captured variables.
auto lambda = [ capturedStr = std::move(str) ] () mutable {
// ^^^^^^^^^^
cout << *capturedStr.get() << endl;
auto str2 = std::move(capturedStr);
};