
AMDG On 11/09/2012 03:45 PM, Lorenzo Caminiti wrote:
Is there a way to inspect if a type is a template instantiaton (is_templated) and the type of the instantiated template parameters (arg1_type)?
is_templated< std::vector<int> >::value // true is_templated< int >::value // false
template_traits< std::vector<int> >::arg1_type // int
If you don't have any non-type template parameters or template template parameters, it's easy: template<class T> struct is_template : boost::mpl::false_ {}; template<template<class...> class T, class... U> struct is_template<T<U...> > : boost::mpl::true_ {}; template<class T> struct template_traits; template<template<class...> class T, class... U> struct template_traits { typedef typename boost::mpl::vector<U...> arg_types; }; In Christ, Steven Watanabe