fork(1) download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. template <typename... Ts>
  5. struct default_constructible;
  6.  
  7. template <typename T>
  8. struct default_constructible<T>
  9. {
  10. static constexpr bool value = std::is_default_constructible<T>::value;
  11. };
  12.  
  13. template <>
  14. struct default_constructible<>
  15. {
  16. static constexpr bool value = true;;
  17. };
  18.  
  19. template <typename T, typename U, typename... Ts>
  20. struct default_constructible<T, U, Ts...>
  21. {
  22. static constexpr bool value = std::is_default_constructible<T>::value && default_constructible<Ts...>::value;
  23. };
  24.  
  25. template <typename... Ts>
  26. struct foo
  27. {
  28. static_assert(default_constructible<Ts...>::value, "");
  29. };
  30.  
  31. class A { A() = delete; };
  32.  
  33. template class foo<int, bool, int, int, char, bool>;
  34. //template class foo<int, bool, A>;
  35.  
  36. int main() {}
Success #stdin #stdout 0s 2892KB
stdin
Standard input is empty
stdout
Standard output is empty