diff --git a/src/include/ranges/multi_range.h b/src/include/ranges/multi_range.h index 2c86698..f6f923c 100644 --- a/src/include/ranges/multi_range.h +++ b/src/include/ranges/multi_range.h @@ -190,6 +190,8 @@ namespace MultiArrayTools template auto get() const -> decltype( *std::get( mSpace ) )&; + size_t getMeta(const MetaType& metaPos) const; + template auto getPtr() const -> decltype( std::get( mSpace ) )&; @@ -556,6 +558,12 @@ namespace MultiArrayTools return *std::get(mSpace); } + template + size_t MultiRange::getMeta(const MetaType& metaPos) const + { + return RPackNum::getMeta(mSpace,metaPos); + } + template template auto MultiRange::getPtr() const -> decltype( std::get( mSpace ) )& diff --git a/src/include/ranges/rpack_num.cc.h b/src/include/ranges/rpack_num.cc.h index d032ae8..9d74c2c 100644 --- a/src/include/ranges/rpack_num.cc.h +++ b/src/include/ranges/rpack_num.cc.h @@ -405,6 +405,15 @@ namespace MultiArrayHelper RPackNum::getTypeNum(res, stp); } + template + template + inline size_t RPackNum::getMeta(const std::tuple...>& space, + const std::tuple& meta) + { + return RPackNum::getMeta(space,meta) * std::get(space)->size() + + std::get(space)->getMeta(std::get(meta)); + } + template @@ -699,6 +708,13 @@ namespace MultiArrayHelper res.insert(res.begin(), tn.begin(), tn.end()); } + template + inline size_t RPackNum<0>::getMeta(const std::tuple...>& space, + const std::tuple& meta) + { + return std::get<0>(space)->getMeta(std::get<0>(meta)); + } + template template diff --git a/src/include/ranges/rpack_num.h b/src/include/ranges/rpack_num.h index aa85f13..94b4083 100644 --- a/src/include/ranges/rpack_num.h +++ b/src/include/ranges/rpack_num.h @@ -180,6 +180,10 @@ namespace MultiArrayHelper template static inline void getTypeNum(vector& res, const std::tuple...>& stp); + + template + static inline size_t getMeta(const std::tuple...>& space, + const std::tuple& meta); }; @@ -315,6 +319,9 @@ namespace MultiArrayHelper template static inline void getTypeNum(vector& res, const std::tuple...>& stp); + template + static inline size_t getMeta(const std::tuple...>& space, + const std::tuple& meta); }; template