When is the use of std::ref necessary?

后端 未结 3 1045
[愿得一人]
[愿得一人] 2020-12-14 07:37

Consider:

std::tuple func (const A& a) 
{
  return std::make_tuple( 0 , std::ref(a) );
}

Is the std::re

3条回答
  •  [愿得一人]
    2020-12-14 08:18

    • make_tuple(0, a) makes a tuple.
    • make_tuple(0, ref(a)) makes a tuple>.
    • You can also say tuple t(0, a); for a tuple you can't make with make_tuple, or use std::tie.

提交回复
热议问题