Consider:
std::tuple func (const A& a)
{
return std::make_tuple( 0 , std::ref(a) );
}
Is the std::re
std::ref does not make a reference, so in your code sample it doesn't do what you expect. std::ref creates an object that behaves similarly to a reference. It may be useful, for example, when you want to instantiate a functor, and pass a reference-like version of it to a standard library algorithm. Since algorithms take functors by value, you can use std::ref to wrap the functor.