Lines Matching refs:Tuple
4 // Example tuple implementation from the variadic templates proposal,
54 template<typename... Values> class tuple;
56 // Basis case: zero-length tuple
57 template<> class tuple<> { };
60 class tuple<Head, Tail...> : private tuple<Tail...> {
61 typedef tuple<Tail...> inherited;
64 tuple() { }
67 // Construct tuple from separate arguments.
68 tuple(typename add_const_reference<Head>::type v,
72 // Construct tuple from another tuple.
73 template<typename... VValues> tuple(const tuple<VValues...>& other)
76 template<typename... VValues> tuple&
77 operator=(const tuple<VValues...>& other) {
93 tuple<> t0a;
94 tuple<> t0b(t0a);
97 tuple<int> t1a;
98 tuple<int> t1b(17);
99 tuple<int> t1c(t1b);
102 tuple<float> t1d(3.14159);
103 tuple<float> t1e(t1d);
109 tuple<int*, float*, double*> t3a(&i, &f, &d);
124 tuple<typename make_tuple_result<Values>::type...>
126 return tuple<typename make_tuple_result<Values>::type...>(values...);
130 tuple<Values&...> tie(Values&... values) {
131 return tuple<Values&...>(values...);
139 const tuple<int, float&, const double&> *t3p = addr(make_tuple(i, ref(f), cref(d)));
140 const tuple<int&, float&, double&> *t3q = addr(tie(i, f, d));
144 template<typename Tuple> struct tuple_size;
146 template<typename... Values> struct tuple_size<tuple<Values...> > {
150 int check_tuple_size_0[tuple_size<tuple<> >::value == 0? 1 : -1];
151 int check_tuple_size_1[tuple_size<tuple<int>>::value == 1? 1 : -1];
152 int check_tuple_size_2[tuple_size<tuple<float, double>>::value == 2? 1 : -1];
153 int check_tuple_size_3[tuple_size<tuple<char, unsigned char, signed char>>::value == 3? 1 : -1];
155 template<int I, typename Tuple> struct tuple_element;
158 struct tuple_element<I, tuple<Head, Tail...> > {
159 typedef typename tuple_element<I-1, tuple<Tail...> >::type type;
163 struct tuple_element<0, tuple<Head, Tail...> > {
167 int check_tuple_element_0[is_same<tuple_element<0, tuple<int&, float, double>>::type,
170 int check_tuple_element_1[is_same<tuple_element<1, tuple<int&, float, double>>::type,
173 int check_tuple_element_2[is_same<tuple_element<2, tuple<int&, float, double>>::type,
177 template<int I, typename Tuple> class get_impl;
179 class get_impl<I, tuple<Head, Values...> > {
180 typedef typename tuple_element<I-1, tuple<Values...> >::type Element;
183 typedef get_impl<I-1, tuple<Values...> > Next;
185 static RJ get(tuple<Head, Values...>& t) { return Next::get(t.tail()); }
186 static PJ get(const tuple<Head, Values...>& t) { return Next::get(t.tail()); }
190 class get_impl<0, tuple<Head, Values...> > {
194 static RJ get(tuple<Head, Values...>& t) { return t.head(); }
195 static PJ get(const tuple<Head, Values...>& t) { return t.head(); }
199 typename tuple_element<I, tuple<Values...> >::type >::type
200 get(tuple<Values...>& t) {
201 return get_impl<I, tuple<Values...> >::get(t);
205 typename tuple_element<I, tuple<Values...> >::type >::type
206 get(const tuple<Values...>& t) {
207 return get_impl<I, tuple<Values...> >::get(t);
210 void test_element_access(tuple<int*, float*, double*&> t3) {
220 inline bool operator==(const tuple<>&, const tuple<>&) { return true; }
223 bool operator==(const tuple<T, TTail...>& t, const tuple<U, UTail...>& u) {
228 bool operator!=(const tuple<TValues...>& t, const tuple<UValues...>& u) {
232 inline bool operator<(const tuple<>&, const tuple<>&) { return false; }
235 bool operator<(const tuple<T, TTail...>& t, const tuple<U, UTail...>& u) {
240 bool operator>(const tuple<TValues...>& t, const tuple<UValues...>& u) {
245 bool operator<=(const tuple<TValues...>& t, const tuple<UValues...>& u) {
250 bool operator>=(const tuple<TValues...>& t, const tuple<UValues...>& u) {
254 void test_relational_operators(tuple<int*, float*, double*> t3) {