#ifndef __helper_tools_h__ #define __helper_tools_h__ #include "base_def.h" #include "slice.h" #include #include "pack_num.h" #include namespace MultiArrayTools { template std::ostream& operator<<(std::ostream& out, const std::tuple& tp); template auto getIndex(std::shared_ptr range) -> std::shared_ptr; // only if 'RangeType' is defaultable and unique (Singleton) template auto getIndex() -> std::shared_ptr; template auto mkMulti(std::shared_ptr... ranges) -> std::shared_ptr >; template auto mkMapR(const Func& f, std::shared_ptr... ranges) -> std::shared_ptr, RangeTypes...> >; template auto mkMapI(const Func& f, std::shared_ptr... indices) -> decltype( getIndex( mkMapR( f, indices->range()... ) ) ); template auto mkMIndex(std::shared_ptr... indices) -> decltype( getIndex( mkMulti( indices.range()... ) ) ); template auto mkMulti(std::tuple...> rangesTuple) -> MultiRange; template auto createExplicit(RangeFactory& rf) -> std::shared_ptr; template auto createExplicit(std::shared_ptr rfp) -> std::shared_ptr; template auto createRange(const std::vector& cvec) -> std::shared_ptr; template auto prtr(const MArray& ma) -> decltype(ma.template getRangePtr()); template inline void For(const std::shared_ptr& ind, const std::function& ll) { for((*ind) = 0; ind->pos() != ind->max(); ++(*ind)){ ll(); } } template inline auto mkOp(const std::shared_ptr& i) -> decltype(std::declval,typename Index::RangeType> > ().exec(i)) { FunctionalMultiArray, typename Index::RangeType> fma(i->range()); return fma.exec(i); } } #endif