    #include <tuple>
    #include <type_traits>
    #include <vector>
    
    template<typename T>
    struct innermost_impl
    {
        using type = T;
    };
    
    template<template<typename...> class E, typename Head, typename... Tail>
    struct innermost_impl<E<Head, Tail...>>
    {
        using type = typename innermost_impl<Head>::type;
    };
    
    template<typename T>
    using innermost = typename innermost_impl<T>::type;
    
    template<class>
    struct X;
    
    static_assert(std::is_same<innermost<X<X<X<int>>>>, int>::value, "");
    
    static_assert(std::is_same<innermost<std::vector<X<std::vector<int>>>>, int>::value, "");
    
    int main()
    {
    }