    namespace detail
    {
        template<class T, int N>
        struct helper
        {
            static constexpr T pow(const T x){
                return helper<T, N-1>::pow(x) * x;
            }
        };

        template<class T>
        struct helper<T, 1>
        {
            static constexpr T pow(const T x){
                return x;
            }
        };

        template<class T>
        struct helper<T, 0>
        {
            static constexpr T pow(const T x){
                return 1;
            }
        };
    }

    template<int N, class T>
    T constexpr pow(T const x)
    {
        return detail::helper<T, N>::pow(x);
    }

    #include <iostream>

    int main()
    {
        std::cout << pow<5>(4);
    }
