add static own type function to range classes
This commit is contained in:
parent
b050ea4466
commit
8c2ced598f
3 changed files with 19 additions and 4 deletions
|
@ -710,14 +710,14 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <class... Ranges>
|
template <class... Ranges>
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
auto MultiRange<Ranges...>::getRange() -> decltype( std::get<N>(MultiRange<Ranges...>::SpaceType()) )
|
typename std::tuple_element<N, std::tuple<Ranges...> >::type& MultiRange<Ranges...>::getRange()
|
||||||
{
|
{
|
||||||
return std::get<N>(mSpace);
|
return std::get<N>(mSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class... Ranges>
|
template <class... Ranges>
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
auto MultiRange<Ranges...>::getRange() const -> decltype( std::get<N>(MultiRange<Ranges...>::SpaceType()) )
|
typename std::tuple_element<N, std::tuple<Ranges...> >::type const& MultiRange<Ranges...>::getRange() const
|
||||||
{
|
{
|
||||||
return std::get<N>(mSpace);
|
return std::get<N>(mSpace);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,11 +112,13 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
static const size_t dim = sizeof...(Ranges);
|
static const size_t dim = sizeof...(Ranges);
|
||||||
|
|
||||||
|
static MultiRange<Ranges...> oType() { return MultiRange<Ranges...>(); }
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
auto getRange() -> decltype( std::get<N>(SpaceType()) );
|
typename std::tuple_element<N, std::tuple<Ranges...> >::type& getRange();
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
auto getRange() const -> decltype( std::get<N>(SpaceType()) );
|
typename std::tuple_element<N, std::tuple<Ranges...> >::type const& getRange() const;
|
||||||
|
|
||||||
size_t size() const override;
|
size_t size() const override;
|
||||||
const SpaceType& space() const;
|
const SpaceType& space() const;
|
||||||
|
|
|
@ -70,6 +70,8 @@ namespace MultiArrayTools
|
||||||
DEFAULT_MEMBERS(SingleRange);
|
DEFAULT_MEMBERS(SingleRange);
|
||||||
|
|
||||||
SingleRange(const std::vector<U>& space);
|
SingleRange(const std::vector<U>& space);
|
||||||
|
|
||||||
|
static SingleRange<U,TYPE> oType() { return SingleRange<U,TYPE>(); }
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const override;
|
||||||
|
|
||||||
|
@ -97,6 +99,8 @@ namespace MultiArrayTools
|
||||||
DEFAULT_MEMBERS(SingleRange);
|
DEFAULT_MEMBERS(SingleRange);
|
||||||
|
|
||||||
SingleRange(size_t ext);
|
SingleRange(size_t ext);
|
||||||
|
|
||||||
|
static SingleRange<int,RangeType::SPACE> oType() { return SingleRange<int,RangeType::SPACE>(); }
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const override;
|
||||||
|
|
||||||
|
@ -121,6 +125,8 @@ namespace MultiArrayTools
|
||||||
DEFAULT_MEMBERS(SingleRange);
|
DEFAULT_MEMBERS(SingleRange);
|
||||||
|
|
||||||
SingleRange(size_t ext);
|
SingleRange(size_t ext);
|
||||||
|
|
||||||
|
static SingleRange<size_t,RangeType::DISTANCE> oType() { return SingleRange<size_t,RangeType::DISTANCE>(); }
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const override;
|
||||||
|
|
||||||
|
@ -145,6 +151,8 @@ namespace MultiArrayTools
|
||||||
DEFAULT_MEMBERS(SingleRange);
|
DEFAULT_MEMBERS(SingleRange);
|
||||||
|
|
||||||
SingleRange(size_t num);
|
SingleRange(size_t num);
|
||||||
|
|
||||||
|
static SingleRange<size_t,RangeType::ENSEMBLE> oType() { return SingleRange<size_t,RangeType::ENSEMBLE>(); }
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const override;
|
||||||
|
|
||||||
|
@ -176,6 +184,9 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
DEFAULT_MEMBERS(SingleRange);
|
DEFAULT_MEMBERS(SingleRange);
|
||||||
|
|
||||||
|
static SingleRange<VET,RangeType::VALUE_ERROR> oType()
|
||||||
|
{ return SingleRange<VET,RangeType::VALUE_ERROR>(); }
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const override;
|
||||||
|
|
||||||
VET get(size_t pos) const;
|
VET get(size_t pos) const;
|
||||||
|
@ -195,6 +206,8 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
DEFAULT_MEMBERS(SingleRange);
|
DEFAULT_MEMBERS(SingleRange);
|
||||||
|
|
||||||
|
static SingleRange<size_t,RangeType::LORENTZ> oType() { return SingleRange<size_t,RangeType::LORENTZ>(); }
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const override;
|
||||||
|
|
||||||
size_t get(size_t pos) const;
|
size_t get(size_t pos) const;
|
||||||
|
|
Loading…
Reference in a new issue