33 #ifndef TUW_LEAF_ACCESS_TREE_HPP 34 #define TUW_LEAF_ACCESS_TREE_HPP 40 template <
typename LeafType,
typename FixContainer,
int ContSize = 0>
44 template <
typename SubType>
49 template <
typename SubType,
size_t N>
52 std::array<SubType, N>
sub_;
54 template <
typename... SubType>
57 std::tuple<SubType...>
sub_;
63 template <
typename NumType,
size_t N>
66 std::array<NumType, N>
sub_;
68 template <
typename NumType>
74 template <
typename NumType>
84 template <
class Derived,
typename LeafType,
typename FixContainer,
int ContSize = 0>
86 : std::conditional<std::is_same<LeafType, FixContainer>::value,
87 typename std::conditional<ContSize == -1,
89 ValArr<LeafType, ContSize> >::type,
90 typename std::conditional<ContSize == -1,
91 SubVecContainer<LeafType>,
92 SubArrContainer<LeafType, ContSize> >::type>::type
101 static constexpr
const bool subDynamic = ContSize == -1;
107 template <bool IsLeaf = isLeaf, typename std::enable_if<(IsLeaf)>::type* =
nullptr>
108 LeafType&
val(
const size_t& _i)
110 return this->
sub_[_i];
112 template <bool IsLeaf = isLeaf, typename std::enable_if<(IsLeaf)>::type* =
nullptr>
113 const LeafType&
val(
const size_t& _i)
const 115 return this->
sub_[_i];
119 template <bool IsLeaf = isLeaf, typename std::enable_if<(!IsLeaf)>::type* =
nullptr>
120 constexpr LeafType&
val(
const size_t& _i)
122 return *(this->valRef_[_i]);
124 template <bool IsLeaf = isLeaf, typename std::enable_if<(!IsLeaf)>::type* =
nullptr>
125 constexpr
const LeafType&
val(
const size_t& _i)
127 return *(this->valRef_[_i]);
131 template <
class Derived,
typename LeafType,
typename... SetTypes,
int ContSize>
140 constexpr LeafType&
val(
const size_t& _i)
142 return *(this->valRef_[_i]);
145 template <
size_t _I>
typename std::tuple_element<_I, TupleType>::type&
sub()
147 return std::get<_I>(this->
sub_);
149 template <
size_t _I>
const typename std::tuple_element<_I, TupleType>::type&
sub()
const 151 return std::get<_I>(this->
sub_);
228 const double&
val(
const size_t& _i)
230 return valImplVirt(_i);
234 virtual const double& valImplVirt(
const size_t& _i) = 0;
237 template <
typename LeafType,
typename FixContainer,
int ContSize>
239 FixContainer, ContSize>,
343 #endif // TUW_LEAF_ACCESS_TREE_HPP
std::vector< NumType * > valRef_
constexpr LeafType & val(const size_t &_i)
Helper function needed to upgrade c++ 2011.
constexpr const LeafType & val(const size_t &_i)
std::tuple< SetTypes... > TupleType
std::vector< NumType > sub_
constexpr LeafType & val(const size_t &_i)
std::vector< SubType > sub_
static constexpr auto value
std::array< SubType, N > sub_
const double & valImplVirt(const size_t &_i)
LeafType & val(const size_t &_i)
std::array< NumType, N > sub_
std::tuple< SubType... > sub_
const std::tuple_element< _I, TupleType >::type & sub() const
const LeafType & val(const size_t &_i) const
const double & val(const size_t &_i)
std::tuple_element< _I, TupleType >::type & sub()
std::vector< LeafType * > valRef_