Consider the following code:
#include <type_traits>
#include <vector>
template<template<class...> class T, class... U>
struct is_specialization_of : std::false_type{};
template<template<class...> class T, class... U>
struct is_specialization_of<T, T<U...>> : std::true_type{};
template<class T, class U = int>
struct test{};
// (1) ok
static_assert(is_specialization_of<test, test<int>>::value);
template<class T>
using alias = test<T>;
// (2) fails
static_assert(is_specialization_of<alias, alias<int>>::value);
int main()
{
}
Why does (2), i.e. static_assert
that uses alias template, fail?
How does the template argument deduction process in (2) differ from the one in (1)?
Aucun commentaire:
Enregistrer un commentaire