#ifndef NDSEIVE_HPP #define NDSEIVE_HPP 1 #include #include template struct ndvector: public std::vector> { static_assert(N > 0, "N should be positive"); using base_tp = ndvector; using base = std::vector; using self = ndvector; template ndvector(T &&n, Ts &&...args): base(n, base_tp(args...)) {} constexpr size_t dim() const { return N; } template void fill(T &&x) { for (auto &i : *this) i.fill(x); } }; template struct ndvector<1, Tp>: public std::vector { using base = std::vector; using self = ndvector<1, Tp>; template ndvector(T &&n): base(n) {} constexpr size_t dim() const { return 1; } template void fill(T &&x) { std::fill(this->begin(), this->end(), x); } }; #endif