I have a std::vector
of std::reference_wrapper
objects that I want to print with printf (without cout); now, if I write
int a=5;
std::reference_wrapper<int> b=a;
printf("%i\n\n",b);
I get a nosense number (I think is the address of a
); to obtain my value I have to do
printf("%i\n\n",b.get());
Is there a way to have automatic call to .get()
function in printf
(e.g. a different %
specificator that print me the reference_wrapper content
) so I can make a generalized function that works both with std::reference_wrapper<type>
and type
?