fork download
  1. #include <type_traits>
  2. #include <vector>
  3.  
  4. template<template<typename...> typename T, typename... U>
  5. struct is_specialization_of : std::false_type{};
  6.  
  7. template<template<typename...> typename T, typename... U>
  8. struct is_specialization_of<T, T<U...>> : std::true_type{};
  9.  
  10. template<typename T, typename U = int>
  11. struct test{};
  12.  
  13. // (1) ok
  14. static_assert(is_specialization_of<test, test<int>>::value);
  15.  
  16. template<typename T>
  17. using alias = test<T>;
  18.  
  19. // (2) fails
  20. static_assert(is_specialization_of<test, alias<int>>::value);
  21.  
  22. int main()
  23. {
  24. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty