jeudi 20 avril 2017

decltype of function parameter

Is it possible to deduce the type of a function parameter? For example, if I have:

void foo(int a);

I would like to deduce the type int as the type of foo's first parameter. A possible use could be:

foo( static_cast< decltype(/* ??? foo's first param ??? */) >(value) );

In this related question, the answers exploit having a member with the same type for deduction, so it does not directly deduce the function parameter type.

Aucun commentaire:

Enregistrer un commentaire