This is an instance of std::tr1::_Bind , created by the type of a function that takes std::tr1::reference_wrapper<int> and returns a pointer to a function that refers to int and returns void.
Here's how to read it:
std::tr1::_Bind< type > should be clear.- type =
void ( fn )(int&) is a function that takes int& and returns void . - fn =
* ptr, so it is actually a function pointer - ptr =
( fn2 )(std::tr1::reference_wrapper<int>) is a function that takes std::tr1::reference_wrapper<int> , and what we still have is a return type. - fn2 = (empty) because we do not give this function (type) a name.
However, as I have now noticed, when fn2 is empty, the parentheses around it probably shouldn't be there either (just like you write a function like โfunction without parameters and returning voidโ as void() , not void()() >.
The case in std::tr1::function is exactly that: the function takes no parameters and returns void , with extra brackets around the empty "function name".
OK, now it is tested: gdb really outputs void() as void()() ; this should probably be seen as a gdb error.
So the correct way to write the first type in C ++ is:
std::tr1::_Bind<void (*(std::tr1::reference_wrapper<int>))(int&)>
source share