#include "multi_array.h" namespace MultiArrayTools { /******************* * MultiArray * *******************/ template MultiArray::MultiArray(const Range& range) : mRange(new Range(range)), mCont(mRange->size()) { mInit = true; } template MultiArray::MultiArray(const Range& range, const std::vector& vec) : mRange(new Range(range)), mCont(vec) { mInit = true; if(mCont.size() > mRange->size()){ mCont.erase(mCont.begin() + mRange->size(), mCont.end()); } } template MultiArray::MultiArray(const Range& range, std::vector&& vec) : mRange(new Range(range)), mCont(vec) { mInit = true; if(mCont.size() > mRange->size()){ mCont.erase(mCont.begin() + mRange->size(), mCont.end()); } } template T& MultiArray::operator[](const typename Range::IndexType& i) { return mCont[ i.pos() ]; } template const T& MultiArray::operator[](const typename Range::IndexType& i) const { return mCont[ i.pos() ]; } template template MultiArrayOperationBase MultiArray::operator()(const NameTypes&... str) { return MultiArrayOperationBase(*this, Name("master", str...)); } template size_t MultiArray::size() const { return mRange->size(); } template auto MultiArray::begin() -> decltype(Range().begin()) { return mRange->begin(); } template auto MultiArray::end() -> decltype(Range().end()) { return mRange->end(); } template bool MultiArray::isSlice() const { return false; } }