You can implement this with a specialization that handles instantiations of A
.
template<typename...>
struct concat_impl; // just a declaration, to allow for specializations
template<std::size_t... s1, std::size_t... s2>
struct concat_impl<A<s1...>, A<s2...>> { // specialize
using type = A<s1..., s2...>; // concatenate
};
and a convenience alias to avoid having to say typename
everywhere.
template<typename A1, typename A2>
using concat = typename concat_impl<A1,A2>::type;
Here's a demo
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…