title: How do I know if object passed as r-value will get moved?
body: <p>I'm passing a lambda to a function which accepts it as a r-value reference.</p>
  
  <p>If my lambda is defined in the function-call itself, I don't really care what happens to it later.<br>
  But if my lambda is a variable (say I want to use it more than once) I do want to know that it is not moved-from.</p>
  
  <p>Is there a way to know will it be moved-from or not, making it unusable or usable accordingly after the call has returned?</p>
  
  <p>EDIT:</p>
  
  <p>Just to clarify, the lambda doesn't capture anything. What I care about is the functor itself: <code>auto fn = [](int a){ return a; };</code></p>
  
  <p>Let me make it even harder. I'll pass the functor as rvalue: <code>std::move(fn)</code></p>
  
  <p>std::move is only a cast. It does not move anything but the rvalue argument in the callee now binds to proper rvalue.</p>
  
  <p>The question is, is <code>fn</code> guaranteed to get moved? Is it guaranteed to not get moved? Is there any guarantee at all? Can I make it behave this way or that way or is it up to the callee?</p>
  
  <p>I want to know because I want to know can I pass <code>fn</code> as a function parameter twice.</p>
  
  <p>EDIT #2:</p>
  
  <p>Let's take another case. I have to call a function with a container. Vector, map, or whatever else. The function signature says <code>&amp;&amp;</code>.
  I can wrap my container with std move or std forward to get an rvalue ref into the callee. It's really the same thing as they are both just glorified casts.</p>
  
  <p>Now, let's say I used std forward because I really like my container to not go anywhere.</p>
  
  <p>I can easily see the callee not being aware of my intention and move my container making it invalid (gutted) after the call.
  Is this a language defect or am i missing something?</p>