How can I use `std::array` for a template parameter of the form `template<typename> class`?

Viewed 1695

Please consider the following tree class

template<typename T, template<typename> class Tuple>
class tree
{
private:
    T m_value;
    Tuple<tree> m_children;
};

template<typename T, std::size_t N>
using static_tree = tree<T, std::array<T, N>>;

which is not well-defined. std::array<T, N> is not a suitable template parameter for Tuple. I assume the intend of static_tree is clear. We could do something like

template<std::size_t N>
struct helper
{
    template<typename T>
    using type = std::array<T, N>;
};

template<typename T, std::size_t N>
using static_tree = tree<T, helper<N>::template type>;

Is there any other option without the helper class?

4 Answers
Related