First, let me introduce you a partial solution:
template <template <class...> class,
typename ...>
struct is_tbase_of:
std::false_type
{ };
template <template <class...> class Type,
typename ...Args>
struct is_tbase_of<Type, Type<Args...>>:
std::true_type
{ };
In common case, it would work:
is_tbase_of<std::vector, std::is_integral<int>>::value; // false
is_tbase_of<std::vector, std::vector<int>>::value; // true
But, it would not work on a «meta-returned» template template, ex:
template <template <class ...> class T>
struct quote
{
template <typename ...U>
using type = T<U...>;
};
using QVec = quote<std::vector>;
is_tbase_of<QVec::template type, std::vector<int>>::value; // false...
I'have tried a lot of things, trying to get the second type template arguments (to compare the quoted type specialisation) but it seem I can't get them, even specializing is_tbase_of for «quote» (which would be a less general but sufficient option) seems to send me to the black corners of template pattern-matching.
Thank you for any idea you can have !
Aucun commentaire:
Enregistrer un commentaire