已解决,可以这么实现:
template <int D>
struct _kdpoly : vector<_kdpoly<D-1>> {};
template <>
struct _kdpoly<1> : vector<int> {};
template <int D>
struct _kdpoly_type {
using type = _kdpoly<D>;
};
template <>
struct _kdpoly_type<0> {
using type = int;
};
template <int D>
using kdpoly = typename _kdpoly_type<D>::type;