std::move a const std::vector in a lambda capture
问题 Motivation: I'm trying to transfer a std::vector<std::unique_ptr<some_type>> to a different thread, via a lambda capture. Since I need the vector to not be cleaned up when the function goes out of scope, I need to take it by value (and not by reference). Since it's a vector of unique_ptrs, I need to move (and not copy) it into the capture. I'm using a generalized lambda capture to move the vector while capturing. Minimal program to illustrate the concept: auto create_vector(){ std::vector<std