21 template<
unsigned N,
typename T>
class ndArray
26 uint64_t multiplicity;
27 mutable uint64_t offset;
33 ndArray () { offset = 0; multiplicity = 1; }
37 { ndat = sz; next.multiplicity = multiplicity * ndat;
return next; }
39 const ndArray<N-1,T>& operator[] (uint64_t idat)
const
40 { next.offset = offset + idat * next.stride();
return next; }
42 ndArray<N-1,T>& operator[] (uint64_t idat)
43 { next.offset = offset + idat * next.stride();
return next; }
45 uint64_t stride ()
const {
return ndat * next.stride(); }
46 uint64_t size ()
const {
return ndat; }
54 uint64_t multiplicity;
55 mutable uint64_t offset;
62 ndArray () { offset = 0; multiplicity = 1; }
64 void operator* (uint64_t sz) { ndat = sz; data.resize (ndat * multiplicity); }
65 const T& operator[] (uint64_t idat)
const {
return data[offset + idat]; }
66 T& operator[] (uint64_t idat) {
return data[offset + idat]; }
68 uint64_t stride ()
const {
return ndat; }
69 uint64_t size ()
const {
return ndat; }