| 1 |
/* Copyright (C) 2015 Povilas Kanapickas <[email protected]> |
| 2 |
|
| 3 |
This file is part of cppreference-doc |
| 4 |
|
| 5 |
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 |
| 6 |
Unported License. To view a copy of this license, visit |
| 7 |
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative |
| 8 |
Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. |
| 9 |
|
| 10 |
Permission is granted to copy, distribute and/or modify this document |
| 11 |
under the terms of the GNU Free Documentation License, Version 1.3 or |
| 12 |
any later version published by the Free Software Foundation; with no |
| 13 |
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. |
| 14 |
*/ |
| 15 |
|
| 16 |
#ifndef CPPREFERENCE_TUPLE_H |
| 17 |
#define CPPREFERENCE_TUPLE_H |
| 18 |
|
| 19 |
#if CPPREFERENCE_STDVER >= 2011 |
| 20 |
|
| 21 |
namespace std { |
| 22 |
|
| 23 |
template<class... Types > |
| 24 |
class tuple { |
| 25 |
public: |
| 26 |
constexpr tuple(); |
| 27 |
template<class... UTypes > |
| 28 |
explicit tuple(UTypes&& ... args); |
| 29 |
template<class... UTypes > |
| 30 |
tuple(const tuple<UTypes...>& other); |
| 31 |
template <class... UTypes> |
| 32 |
tuple(tuple<UTypes...>&& other); |
| 33 |
template<class U1, class U2 > |
| 34 |
tuple(const pair<U1, U2>& p); |
| 35 |
template<class U1, class U2 > |
| 36 |
tuple(pair<U1, U2>&& p); |
| 37 |
tuple(const tuple& other) = default; |
| 38 |
tuple(tuple&& other) = default; |
| 39 |
|
| 40 |
template<class Alloc > |
| 41 |
tuple(std::allocator_arg_t, const Alloc& a); |
| 42 |
|
| 43 |
template<class Alloc > |
| 44 |
tuple(std::allocator_arg_t, const Alloc& a, const Types& ... args); |
| 45 |
|
| 46 |
template<class Alloc, class... UTypes > |
| 47 |
tuple(std::allocator_arg_t, const Alloc& a, UTypes&& ... args); |
| 48 |
|
| 49 |
template <class Alloc, class... UTypes> |
| 50 |
tuple(std::allocator_arg_t, const Alloc& a, const tuple<UTypes...>& other); |
| 51 |
|
| 52 |
template<class Alloc, class... UTypes > |
| 53 |
tuple(std::allocator_arg_t, const Alloc& a, tuple<UTypes...>&& other); |
| 54 |
|
| 55 |
template<class Alloc, class U1, class U2 > |
| 56 |
tuple(std::allocator_arg_t, const Alloc& a, const pair<U1, U2>& p); |
| 57 |
|
| 58 |
template<class Alloc, class U1, class U2 > |
| 59 |
tuple(std::allocator_arg_t, const Alloc& a, pair<U1, U2>&& p); |
| 60 |
|
| 61 |
template<class Alloc > |
| 62 |
tuple(std::allocator_arg_t, const Alloc& a, const tuple& other); |
| 63 |
|
| 64 |
template<class Alloc > |
| 65 |
tuple(std::allocator_arg_t, const Alloc& a, tuple&& other); |
| 66 |
|
| 67 |
tuple& operator=(const tuple& other); |
| 68 |
|
| 69 |
tuple& operator=(tuple&& other); |
| 70 |
|
| 71 |
template<class... UTypes > |
| 72 |
tuple& operator=(const tuple<UTypes...>& other); |
| 73 |
|
| 74 |
template<class... UTypes > |
| 75 |
tuple& operator=(tuple<UTypes...>&& other); |
| 76 |
|
| 77 |
template<class U1, class U2 > |
| 78 |
tuple& operator=(const pair<U1, U2>& p); |
| 79 |
|
| 80 |
template<class U1, class U2 > |
| 81 |
tuple& operator=(pair<U1, U2>&& p); |
| 82 |
|
| 83 |
void swap(tuple& other); |
| 84 |
}; |
| 85 |
|
| 86 |
template<class... Types > |
| 87 |
tuple<VTypes...> make_tuple(Types&& ... args); |
| 88 |
|
| 89 |
template<class... Types > |
| 90 |
tuple<Types& ...> tie(Types& ... args); |
| 91 |
|
| 92 |
template<class... Types > |
| 93 |
tuple < Types&& ... > forward_as_tuple(Types&& ... args); |
| 94 |
|
| 95 |
template<class... Tuples > |
| 96 |
std::tuple<CTypes...> tuple_cat(Tuples&& ... args); |
| 97 |
|
| 98 |
template<std::size_t I, class... Types > |
| 99 |
typename std::tuple_element<I, tuple<Types...> >::type& |
| 100 |
get(tuple<Types...>& t); |
| 101 |
|
| 102 |
template<std::size_t I, class... Types > |
| 103 |
typename std::tuple_element<I, tuple<Types...> >::type&& |
| 104 |
get(tuple<Types...>&& t); |
| 105 |
|
| 106 |
template<std::size_t I, class... Types > |
| 107 |
typename std::tuple_element<I, tuple<Types...> >::type const& |
| 108 |
get(const tuple<Types...>& t); |
| 109 |
|
| 110 |
template<class... TTypes, class... UTypes > |
| 111 |
bool operator==(const tuple<TTypes...>& lhs, |
| 112 |
const tuple<UTypes...>& rhs); |
| 113 |
template<class... TTypes, class... UTypes > |
| 114 |
bool operator!=(const tuple<TTypes...>& lhs, |
| 115 |
const tuple<UTypes...>& rhs); |
| 116 |
template<class... TTypes, class... UTypes > |
| 117 |
bool operator<(const tuple<TTypes...>& lhs, |
| 118 |
const tuple<UTypes...>& rhs); |
| 119 |
template<class... TTypes, class... UTypes > |
| 120 |
bool operator<=(const tuple<TTypes...>& lhs, |
| 121 |
const tuple<UTypes...>& rhs); |
| 122 |
template<class... TTypes, class... UTypes > |
| 123 |
bool operator>(const tuple<TTypes...>& lhs, |
| 124 |
const tuple<UTypes...>& rhs); |
| 125 |
template<class... TTypes, class... UTypes > |
| 126 |
bool operator>=(const tuple<TTypes...>& lhs, |
| 127 |
const tuple<UTypes...>& rhs); |
| 128 |
|
| 129 |
template<class... Types > |
| 130 |
void swap(tuple<Types...>& lhs, tuple<Types...>& rhs); |
| 131 |
|
| 132 |
template<class... Types > |
| 133 |
class tuple_size<std::tuple<Types...> > : public std::integral_constant<std::size_t, sizeof...(Types)> { }; |
| 134 |
|
| 135 |
template<std::size_t I, class... Types > |
| 136 |
class tuple_element<I, tuple<Types...> > { |
| 137 |
typedef void type; |
| 138 |
}; // SIMPLIFIED |
| 139 |
|
| 140 |
const void* ignore; // SIMPLIFIED |
| 141 |
|
| 142 |
} // namespace std |
| 143 |
|
| 144 |
#endif // CPPREFERENCE_STDVER >= 2011 |
| 145 |
|
| 146 |
#endif // CPPREFERENCE_TUPLE_H |