I'm using lambda generalized capture to move a unique_ptr into a lambda (https://stackoverflow.com/a/16968463/118958). I want to pass this lambda elsewhere to set a callback function, but I'm not sure how.
Here's a small example with what I'm trying to do that fails to compile:
void set_callback(std::function<void(void)> cb);
void move_callback(std::function<void(void)> &&cb);
void test() {
    auto a_ptr = std::make_unique<int>(10);
    auto lambda = [a_ptr = std::move(a_ptr)] () {};
    // set_callback(lambda);            // I understand why this wouldn't work
    move_callback(std::move(lambda));   // but I would expect this to be OK
}
Any idea on how to do something like the above?
 
     
    