I have a type like Type<Param>. How I can retrieve the Param in c++11?
May be something like that:
// I know it's not correct but it conveys the idea very well
template
<
template <class Param> class Type
>
struct GetParam
{
typedef Param Result;
};
// e.g.
typedef GetParam<std::vector<double>>::Result X; // must return double
typedef GetParam<std::list<double>>::Result X; // double
typedef GetParam<std::vector<std::list<double>>::Result X; // std::list<double>
However the class template specialization you pass to
GetParamcan only have type template arguments. So you cannot passstd::arrayfor example. It is not possible to do a fully genericGetParam, because you would have to enlist every possible template parameter list variety, and there are basically infinitely many.