Suppose we have a function f which returns a value of some unknown type (let\'s call it T) and takes a value of the type T as an argum
template
struct return_type;
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
struct return_type { using type = R; };
template
using return_type_t = typename return_type::type;
Test:
#include
struct Functor
{
int operator()(int i, int j) { return i + j; }
};
template
struct A
{
using T = return_type_t;
T some_function(T some_arg) { return some_arg; }
};
int main()
{
A a;
static_assert(std::is_same::value, "!");
}
DEMO