Odd template

In type_traits I can see:
// [func.require] paragraph 1 bullet 1:
struct __result_of_memfun_ref_impl
{
template<typename _Fp, typename _Tp1, typename... _Args>
static __result_of_success<decltype(
(std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
), __invoke_memfun_ref> _S_test(int);

template<typename...>
static __failure_type _S_test(...);
};


Especially "( ) . * std" - what means this parens, dot and star ?
Last edited on
Last edited on
To explicitly answer each of these:

std::declval is a function, so the parentheses are just the usual syntax for a function call.

https://en.cppreference.com/w/cpp/utility/declval

The .* is, as mbozzi says, accessing a member of the object returned by the function. Specifically, the member is a pointer, so the star is dereferencing the pointer.

In other words, these symbols have their normal C++ meanings. It just looks a bit confusing because they're all being used close together in the same line.
Last edited on
Topic archived. No new replies allowed.