Can std::function be move-constructed from rvalue reference to a temporary functor object?
问题 I have an untemplated functor object that I'm trying to store as a std::function inside another object. This object is really heavyweight, so it's marked as uncopyable, but it does have a move constructor. However, trying to construct a std::function, or assign it, from a temporary constructor fails. Here is a minimal example to provoke the error. // pretend this is a really heavyweight functor that can't be copied. struct ExampleTest { int x; int operator()(void) const {return x*2;}