fork download
  1. #include <tuple>
  2. #include <type_traits>
  3. #include <vector>
  4.  
  5. template<typename T>
  6. struct innermost_impl
  7. {
  8. using type = T;
  9. };
  10.  
  11. template<template<typename...> class E, typename Head, typename... Tail>
  12. struct innermost_impl<E<Head, Tail...>>
  13. {
  14. using type = typename innermost_impl<Head>::type;
  15. };
  16.  
  17. template<typename T>
  18. using innermost = typename innermost_impl<T>::type;
  19.  
  20. template<class>
  21. struct X;
  22.  
  23. static_assert(std::is_same<innermost<X<X<X<int>>>>, int>::value, "");
  24.  
  25. static_assert(std::is_same<innermost<std::vector<X<std::vector<int>>>>, int>::value, "");
  26.  
  27. int main()
  28. {
  29. }
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty