diff --git a/src/multi_range.cc b/src/multi_range.cc index 754b13a..dfc9128 100644 --- a/src/multi_range.cc +++ b/src/multi_range.cc @@ -710,14 +710,14 @@ namespace MultiArrayTools template template - auto MultiRange::getRange() -> decltype( std::get(MultiRange::SpaceType()) ) + typename std::tuple_element >::type& MultiRange::getRange() { return std::get(mSpace); } template template - auto MultiRange::getRange() const -> decltype( std::get(MultiRange::SpaceType()) ) + typename std::tuple_element >::type const& MultiRange::getRange() const { return std::get(mSpace); } diff --git a/src/multi_range.h b/src/multi_range.h index 27c1c64..e5d788a 100644 --- a/src/multi_range.h +++ b/src/multi_range.h @@ -112,11 +112,13 @@ namespace MultiArrayTools static const size_t dim = sizeof...(Ranges); + static MultiRange oType() { return MultiRange(); } + template - auto getRange() -> decltype( std::get(SpaceType()) ); + typename std::tuple_element >::type& getRange(); template - auto getRange() const -> decltype( std::get(SpaceType()) ); + typename std::tuple_element >::type const& getRange() const; size_t size() const override; const SpaceType& space() const; diff --git a/src/single_range.h b/src/single_range.h index b1ca52e..f60ef5e 100644 --- a/src/single_range.h +++ b/src/single_range.h @@ -70,6 +70,8 @@ namespace MultiArrayTools DEFAULT_MEMBERS(SingleRange); SingleRange(const std::vector& space); + + static SingleRange oType() { return SingleRange(); } virtual size_t size() const override; @@ -97,6 +99,8 @@ namespace MultiArrayTools DEFAULT_MEMBERS(SingleRange); SingleRange(size_t ext); + + static SingleRange oType() { return SingleRange(); } virtual size_t size() const override; @@ -121,6 +125,8 @@ namespace MultiArrayTools DEFAULT_MEMBERS(SingleRange); SingleRange(size_t ext); + + static SingleRange oType() { return SingleRange(); } virtual size_t size() const override; @@ -145,6 +151,8 @@ namespace MultiArrayTools DEFAULT_MEMBERS(SingleRange); SingleRange(size_t num); + + static SingleRange oType() { return SingleRange(); } virtual size_t size() const override; @@ -176,6 +184,9 @@ namespace MultiArrayTools DEFAULT_MEMBERS(SingleRange); + static SingleRange oType() + { return SingleRange(); } + virtual size_t size() const override; VET get(size_t pos) const; @@ -195,6 +206,8 @@ namespace MultiArrayTools DEFAULT_MEMBERS(SingleRange); + static SingleRange oType() { return SingleRange(); } + virtual size_t size() const override; size_t get(size_t pos) const;