22 #ifndef GEARS_UTILITY_TRIPLE_HPP
23 #define GEARS_UTILITY_TRIPLE_HPP
25 #include "../meta/alias.hpp"
54 template<
typename T,
typename U,
typename V>
57 using second_type = U;
75 swap(second, t.second);
91 template<
typename T,
typename U,
typename V>
93 return lhs.first == rhs.first && lhs.second == rhs.second && lhs.third == rhs.third;
105 template<
typename T,
typename U,
typename V>
107 return lhs.first < rhs.first ?
true :
108 rhs.first < lhs.first ?
false :
109 lhs.second < rhs.second ?
true :
110 rhs.second < lhs.second ?
false :
111 lhs.third < rhs.third;
124 template<
typename T,
typename U,
typename V>
126 return !(lhs == rhs);
138 template<
typename T,
typename U,
typename V>
153 template<
typename T,
typename U,
typename V>
168 template<
typename T,
typename U,
typename V>
181 template<
typename T,
typename U,
typename V>
203 template<
typename T,
typename U,
typename V>
205 return { std::forward<T>(t), std::forward<U>(u), std::forward<V>(v) };
210 namespace triple_detail {
211 template<
size_t N>
struct triple_get;
214 struct triple_get<0> {
215 template<
typename T,
typename U,
typename V>
220 template<
typename T,
typename U,
typename V>
225 template<
typename T,
typename U,
typename V>
227 return std::forward<T>(t.first);
232 struct triple_get<1> {
233 template<
typename T,
typename U,
typename V>
238 template<
typename T,
typename U,
typename V>
243 template<
typename T,
typename U,
typename V>
245 return std::forward<U>(t.second);
250 struct triple_get<2> {
251 template<
typename T,
typename U,
typename V>
256 template<
typename T,
typename U,
typename V>
261 template<
typename T,
typename U,
typename V>
263 return std::forward<V>(t.third);
269 template<
typename T>
struct tuple_size;
270 template<
size_t N,
typename T>
struct tuple_element;
272 template<
typename T,
typename U,
typename V>
273 struct tuple_size<gears::utility::triple<T, U, V>> :
gears::meta::Const<size_t, 3> {};
275 template<
typename T,
typename U,
typename V>
276 struct tuple_element<0, gears::utility::triple<T, U, V>> {
280 template<
typename T,
typename U,
typename V>
281 struct tuple_element<1, gears::utility::triple<T, U, V>> {
285 template<
typename T,
typename U,
typename V>
286 struct tuple_element<2, gears::utility::triple<T, U, V>> {
293 template<
size_t N,
typename T,
typename U,
typename V>
298 template<
size_t N,
typename T,
typename U,
typename V>
300 return triple_detail::triple_get<N>::const_get(t);
303 template<
size_t N,
typename T,
typename U,
typename V>
305 return triple_detail::triple_get<N>::move_get(std::move(t));
310 #endif // GEARS_UTILITY_TRIPLE_HPP