16 template <
typename...>
class tuple;
22 template <
typename _Ty,
typename ...>
class tuple_item;
23 template <
typename _Ty>
class tuple_item<_Ty>{};
25 template <
typename _Ty,
typename ... _Ts>
class tuple_item<_Ty, _Ty, _Ts...> {
27 static _Ty&
get(
tuple<_Ty, _Ts...>& oTuple) {
return oTuple.Value; }
29 template <
typename _Ty,
typename _HeadT,
typename ... _TailT>
class tuple_item<_Ty, _HeadT, _TailT...> {
31 static _Ty&
get(
tuple<_HeadT, _TailT...>& oTuple) {
return tuple_item<_Ty, _TailT...>::get(
static_cast<tuple<_TailT...
>&>(oTuple)); }
35 template <int,
typename ...>
class tuple_index;
36 template <
typename _HeadT,
typename..._TailT>
class tuple_index<0, _HeadT, _TailT...> {
38 using value_type = _HeadT;
39 static value_type&
get(
tuple<_HeadT, _TailT...>& oTuple) {
return oTuple.Value; }
41 template <
int index,
typename _HeadT,
typename..._TailT>
class tuple_index<index, _HeadT, _TailT...> {
43 using value_type =
typename tuple_index<index-1, _TailT...>::value_type;
44 static value_type&
get(
tuple<_HeadT, _TailT...>& oTuple) {
return tuple_index<index - 1, _TailT...>::get(
static_cast<tuple<_TailT...
>&>(oTuple)); }
48 template <
typename,
typename>
class tuple_append;
49 template <
typename _Ty,
typename ... _TupleTs>
class tuple_append<_Ty, xtd::
tuple<_TupleTs...>> {
51 using tuple_type =
xtd::tuple<_TupleTs..., _Ty>;
53 template <
typename ... _AppendTs,
typename ... _TupleTs>
class tuple_append<xtd::
tuple<_AppendTs...>,
xtd::tuple<_TupleTs...>> {
55 using tuple_type =
xtd::tuple<_TupleTs..., _AppendTs...>;
59 template <
typename,
typename>
class tuple_prepend;
60 template <
typename _Ty,
typename ... _TupleTs>
class tuple_prepend<_Ty, xtd::
tuple<_TupleTs...>> {
62 using tuple_type =
xtd::tuple<_Ty, _TupleTs...>;
64 template <
typename ... _PrependTs,
typename ... _TupleTs>
class tuple_prepend<xtd::
tuple<_PrependTs...>,
xtd::tuple<_TupleTs...>> {
66 using tuple_type =
xtd::tuple<_PrependTs..., _TupleTs...>;
70 template <
typename,
typename...>
class tuple_index_of;
71 template <
typename _Ty,
typename..._TailT>
class tuple_index_of<_Ty, _Ty, _TailT...> {
73 static constexpr
int value = 0;
75 template <
typename _Ty,
typename _HeadT,
typename..._TailT>
class tuple_index_of<_Ty, _HeadT, _TailT...> {
77 static constexpr
int value = 1 + tuple_index_of<_Ty, _TailT...>::value;
90 static constexpr
size_t Length = 0;
97 template <
typename _HeadT,
typename ... _TailT>
class tuple<_HeadT, _TailT...> :
public tuple<_TailT...>{
101 using value_type = _HeadT;
102 static constexpr
size_t Length = 1 + _super_t::Length;
108 template <
typename _Ty> _Ty&
Item() {
return _::tuple_item<_Ty, _HeadT, _TailT...>::get(*
this); }
110 template <
int index>
typename _::tuple_index<index, _HeadT, _TailT...>::value_type&
Index() {
return _::tuple_index<index, _HeadT, _TailT...>::get(*
this); }
112 template <
typename _Ty>
using Append =
typename _::tuple_append<_Ty,
tuple<_HeadT, _TailT...>>::tuple_type;
114 template <
typename _Ty>
using Prepend =
typename _::tuple_prepend <_Ty,
tuple<_HeadT, _TailT...>>::tuple_type;
116 template <
typename _Ty>
using index_of = _::tuple_index_of<_Ty, _HeadT, _TailT...>;
119 tuple(
tuple&& src) : _super_t(std::move(src)), Value(std::move(src.value)) {}
120 tuple(
const tuple& src) : _super_t(src), Value(src.Value) {}
_Ty & Item()
Gets an item from the tuple by type.
Tuple specialization with one or more elements.
host, target and build configurations and settings Various components are purpose built for specific ...
_::tuple_index_of< _Ty, _HeadT, _TailT...> index_of
Gets the index of a specified type.
_::tuple_index< index, _HeadT, _TailT...>::value_type & Index()
Gets an item from the tuple by index.
typename _::tuple_append< _Ty, tuple< _HeadT, _TailT...>>::tuple_type Append
Appends a type to the tuple.
typename _::tuple_prepend< _Ty, tuple< _HeadT, _TailT...>>::tuple_type Prepend
Prepends a type to the tuple.