// -*- C++ -*- #ifndef __multi_array_h__ #define __multi_array_h__ #include #include #include #include "base_def.h" #include "multi_array_operation.h" #include "name.h" namespace MultiArrayTools { template class MultiArrayBase { public: DEFAULT_MEMBERS(MultiArrayBase); MultiArrayBase(const Range& range); virtual T& operator[](const typename Range::IndexType& i) = 0; virtual const T& operator[](const typename Range::IndexType& i) const = 0; virtual size_t size() const; virtual bool isSlice() const = 0; virtual auto begin() -> decltype(Range().begin()); virtual auto end() -> decltype(Range().end()); virtual const Range& range() const; template MultiArrayOperationRoot operator()(const NameTypes&... str); protected: std::shared_ptr mRange; }; template class MultiArray : public MultiArrayBase { public: typedef MultiArrayBase MAB; DEFAULT_MEMBERS(MultiArray); MultiArray(const Range& range); MultiArray(const Range& range, const std::vector& vec); MultiArray(const Range& range, std::vector&& vec); T& operator[](const typename Range::IndexType& i) override; const T& operator[](const typename Range::IndexType& i) const override; virtual bool isSlice() const override; private: std::vector mCont; }; } #include "multi_array.cc" #endif