#include #include "ndvector.hpp" using std::cout, std::endl; template < class Ch, class Tr, class Ct, std::enable_if_t().begin()), typename Ct::iterator>::value && std::is_same().end()), typename Ct::iterator>::value> * = nullptr> std::basic_ostream &operator<<(std::basic_ostream &os, const Ct &x) { if (x.begin() == x.end()) return os << "[]"; os << '['; for (auto it = x.begin(); it != x.end() - 1; ++it) os << *it << ", "; return os << x.back() << ']'; } #define OUTPUT_(x) cout << #x << ": " << x << endl int main() { ndvector<5, int> v(5, 4, 3, 2, 1); OUTPUT_(v.dim()); OUTPUT_(v[0].dim()); OUTPUT_(v[0][0].dim()); OUTPUT_(v); v.fill(114514); OUTPUT_(v); cout << "==========" << endl; ndvector<5, int> v2(5, 4, 0, 2, 1); OUTPUT_(v2.dim()); OUTPUT_(v2); return 0; } // clang-format off /* outout: v.dim(): 5 v[0].dim(): 4 v[0][0].dim(): 3 v: [[[[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]]], [[[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]]], [[[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]]], [[[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]]], [[[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]], [[[0], [0]], [[0], [0]], [[0], [0]]]]] v: [[[[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]]], [[[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]]], [[[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]]], [[[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]]], [[[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]], [[[114514], [114514]], [[114514], [114514]], [[114514], [114514]]]]] ========== v2.dim(): 5 v2: [[[], [], [], []], [[], [], [], []], [[], [], [], []], [[], [], [], []], [[], [], [], []]] */