In this code, func_i_dont_control cannot steal the parameter silently. Only rvalues are bound to rvalue references, and the named variable is not an rvalue. Your code is either not compiled, or func_i_dont_control (has overload) does not use move semantics.
To give func_i_dont_control chance to steal a tuple (bind the tuple to an rvalue link), it must be explicitly passed to rvalue using std::move(tup) .
(A function that takes a reference to an lvalue should not move from it, otherwise we really cannot say what will happen.)
Change But the question, it seems, is not what the tuple itself is, but its members. Again, these members will not be rvalues, so func_i_dont_control will need to be moved explicitly. I don’t think it has a “moral right” * to do this, unless it receives the whole tuple as an rvalue, which is not happening in your function.
* With the semantics of move, you should follow certain recommendations. Basically, you can overlay something on the rvalue and move away from it, no matter if you are dealing with lvalue or rvalue links. As long as you follow these guidelines, move-semantics will work correctly. If you start throwing things at rvalues without considering these recommendations, objects will start to disappear after function calls, etc.
source share