#ifndef __vindex_wrapper_h__ #define __vindex_wrapper_h__ #include "ranges/vindex_base.h" namespace MultiArrayTools { template std::shared_ptr > make_viwb(std::shared_ptr idxPtr) { return std::make_shared >(idxPtr); } template class IndexWrapper : public VirtualIndexWrapperBase { public: DEFAULT_MEMBERS(IndexWrapper); IndexWrapper(std::shared_ptr idxPtr) : mIdxPtr(idxPtr) {} virtual IndexType type() const override { return mIdxPtr->type(); } virtual size_t dim() const override { return mIdxPtr->dim(); } virtual size_t pos() const override { return mIdxPtr->pos(); } virtual size_t max() const override { return mIdxPtr->max(); } virtual std::shared_ptr rangePtr() const override { return mIdxPtr->vrange(); } virtual std::shared_ptr getPtr(size_t n) const override { return mIdxPtr->getVPtr(n); } virtual std::intptr_t getPtrNum() const override { return reinterpret_cast( mIdxPtr.get() ); } virtual size_t getStepSize(size_t n) const override { return mIdxPtr->getStepSize(n); } std::shared_ptr get() const { return mIdxPtr; } // unwrap private: std::shared_ptr mIdxPtr; }; } #endif