Simple mathematical operations (add, sub, mul, div) in C++11 template
When passing around move references, the recommended is to forward the parameters to ensure that the move reference is preserved:

template &lt;typename T, typename ... Types&gt;
auto add(T&amp;&amp; first, Types&amp;&amp; ... rest) 
    -&gt; decltype(first + add(std::forward&lt;Types&gt;(rest)...))
{
    return first + add(std::forward&lt;Types&gt;(rest)...);
}


Note that you have to explicitly provide the template type to std::forward(). It would deduce the wrong type otherwise.