5#ifndef INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_PAIR_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_PAIR_HPP_
48template <
typename T1,
typename T2>
53 using first_type = T1;
55 using second_type = T2;
68 template <
typename Arg1,
typename Arg2>
75 template <
typename Arg1,
typename Arg2>
82 template <
typename Arg1,
typename Arg2>
89 template <
typename Arg1,
typename Arg2>
101 typename CheckType1 = T1,
102 typename CheckType2 = T2,
123 typename CheckType1 = T1,
124 typename CheckType2 = T2,
129 explicit constexpr pair(
130 first_type
const& val1,
131 second_type
const& val2
149 typename CheckType1 = T1,
150 typename CheckType2 = T2,
156 first_type
const& val1,
157 second_type
const& val2
180 explicit constexpr pair(
184 : first(std::
forward<Arg1>(val1)),
185 second(std::
forward<Arg2>(val2)) {}
208 : first(std::
forward<Arg1>(val1)),
209 second(std::
forward<Arg2>(val2)) {}
227 explicit constexpr pair(pair<Arg1, Arg2>
const& other
229 : pair(other.first, other.second) {}
248 constexpr pair(pair<Arg1, Arg2>
const& other
250 : pair(other.first, other.second) {}
272 explicit constexpr pair(pair<Arg1, Arg2>&& other
274 : first(std::
forward<Arg1>(other.first)),
275 second(std::
forward<Arg2>(other.second)) {}
302 constexpr pair(pair<Arg1, Arg2>&& other
304 : first(std::
forward<Arg1>(other.first)),
305 second(std::
forward<Arg2>(other.second)) {}
322 template <
typename... Args1,
typename... Args2,
size_t... I1,
size_t... I2>
326 : first{std::
forward<Args1>(
get<I1>(first_args))...},
327 second{std::
forward<Args2>(
get<I2>(second_args))...} {}
350 piecewise_construct_t,
351 tuple<Args1...> first_args,
352 tuple<Args2...> second_args
373 auto operator=(pair<Arg1, Arg2>
const& other
376 second = other.second;
401 auto operator=(pair<Arg1, Arg2>&& other
420 typename CheckType1 = T1,
421 typename CheckType2 = T2,
425 void swap(pair& other
428 swap(first, other.first);
429 swap(second, other.second);
446 enable_if_t<arene::base::is_swappable_v<T1>>,
447 enable_if_t<arene::base::is_swappable_v<T2>>> =
nullptr>
467template <
typename T1,
typename T2>
469 pair<T1, T2>
const& lhs,
470 pair<T1, T2>
const& rhs
473 return (lhs.first < rhs.first) || ((!(rhs.first < lhs.first)) && (lhs.second < rhs.second));
488template <
typename T1,
typename T2>
490 pair<T1, T2>
const& lhs,
491 pair<T1, T2>
const& rhs
509template <
typename T1,
typename T2>
511 pair<T1, T2>
const& lhs,
512 pair<T1, T2>
const& rhs
530template <
typename T1,
typename T2>
532 pair<T1, T2>
const& lhs,
533 pair<T1, T2>
const& rhs
551template <
typename T1,
typename T2>
553 pair<T1, T2>
const& lhs,
554 pair<T1, T2>
const& rhs
557 return (lhs.first == rhs.first) && (lhs.second == rhs.second);
572template <
typename T1,
typename T2>
574 pair<T1, T2>
const& lhs,
575 pair<T1, T2>
const& rhs
578 return !(lhs == rhs);
588template <
class T1,
class T2>
610template <
class T1,
class T2>
626namespace pair_detail {
664template <
size_t I,
class T1,
class T2>
676template <
size_t I,
class T1,
class T2>
688template <
size_t I,
class T1,
class T2>
701template <
size_t I,
class T1,
class T2>
713template <
class T1,
class T2>
714constexpr auto get(pair<T1, T2>& values)
noexcept -> T1& {
727template <
class T1,
class T2>
728constexpr auto get(pair<T1, T2>
const& values)
noexcept -> T1
const& {
740template <
class T1,
class T2>
741constexpr auto get(pair<T1, T2>&& values)
noexcept -> T1&& {
752template <
class T1,
class T2>
753constexpr auto get(pair<T1, T2>
const&& values)
noexcept -> T1
const&& {
767template <
class T2,
class T1>
768constexpr auto get(pair<T1, T2>& values)
noexcept -> T2& {
769 return values.second;
784template <
class T2,
class T1>
785constexpr auto get(pair<T1, T2>
const& values)
noexcept -> T2
const& {
786 return values.second;
800template <
class T2,
class T1>
801constexpr auto get(pair<T1, T2>&& values)
noexcept -> T2&& {
815template <
class T2,
class T1>
816constexpr auto get(pair<T1, T2>
const&& values)
noexcept -> T2
const&& {
826template <
class T1,
class T2>
836template <
class T1,
class T2>
847template <
class T1,
class T2>
A helper class to represent a compile-time constant with the specified type and value....
Definition integral_constant.hpp:23
T1 type
type at index 0
Definition pair.hpp:830
T2 type
type at index 1
Definition pair.hpp:840
obtains the type of the specified element
Definition tuple_element.hpp:28
obtain the number of elements in a tuple-like type
Definition tuple_size.hpp:22
Public export header for the constraints subpackage.
constexpr bool is_nothrow_swappable_v
Trait query indicating if a type can be noexcept-swapped.
unwrap_reference_t< std::decay_t< T > > unwrap_ref_decay_t
Backport of std::unwrap_ref_decay_t from C++20.
Definition unwrap_reference.hpp:55
constexpr auto get(array< T, N > &arr) noexcept -> T &
Get a reference to the element at the specified index in the array.
Definition array.hpp:885
constexpr bool is_nothrow_equality_comparable_v
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
constexpr bool is_nothrow_less_than_comparable_v
pair<::arene::base::unwrap_ref_decay_t< T1 >, ::arene::base::unwrap_ref_decay_t< T2 > > deduced_pair_type_t
Internal helper to deduce the expected std::pair type.
Definition pair.hpp:589
constexpr auto get_impl(integral_constant< size_t, 0 >, Pair &&values) noexcept ->
access an element of a pair
Definition pair.hpp:637
auto operator<=(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if one iterator is less than or equal to another.
Definition move_iterator.hpp:294
void swap(pair< T1, T2 > &lhs, pair< T1, T2 > &rhs) noexcept(arene::base::is_nothrow_swappable_v< T1 > &&arene::base::is_nothrow_swappable_v< T2 >)
Swap a pair with another instance of the same type. Swaps lhs.first with rhs.first and swaps lhs....
Definition pair.hpp:448
auto operator>=(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if one iterator is greater than or equal to another.
Definition move_iterator.hpp:316
constexpr auto move(T &&value) noexcept -> remove_reference_t< T > &&
Cast a value to an rvalue.
Definition move.hpp:30
constexpr auto make_pair(T1 &&first, T2 &&second) noexcept(is_nothrow_constructible_v< pair_detail::deduced_pair_type_t< T1, T2 >, T1, T2 >) -> pair_detail::deduced_pair_type_t< T1, T2 >
Creates a std::pair object, deducing the target type from the types of arguments.
Definition pair.hpp:611
auto operator!=(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if two iterators are not equal.
Definition move_iterator.hpp:271
constexpr bool is_same_v
Trait to detect if the two supplied types are the same or not. The value is true if the types are the...
integer_sequence< size_t, Ints... > index_sequence
A helper alias template for integer_sequence<size_t, Ints>
Definition integer_sequence.hpp:218
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
constexpr bool is_nothrow_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
auto operator<(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if one iterator is less than another.
Definition move_iterator.hpp:283
constexpr bool is_convertible_v
Type trait to detect if one type is convertible to another.
constexpr bool is_nothrow_constructible_v
Type trait to detect if a type is constructible from arguments of the specified types and is noexcept...
auto operator==(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if two iterators are equal.
Definition move_iterator.hpp:258
constexpr piecewise_construct_t piecewise_construct
Tag constant for piecewise construction.
Definition pair.hpp:42
constexpr bool is_nothrow_copy_constructible_v
Type trait to detect if an instance of T is copy constructible without throwing.
typename tuple_element< I, T >::type tuple_element_t
obtains the type of the specified element
Definition tuple_element.hpp:68
constexpr bool is_constructible_v
Type trait to detect if a type is constructible from arguments of the specified types.
constexpr auto get(pair< T1, T2 > &values) noexcept -> tuple_element_t< I, pair< T1, T2 > > &
access an element of a pair
Definition pair.hpp:665
make_index_sequence< sizeof...(Types)> index_sequence_for
A helper alias template convert any type parameter pack into an index sequence of the same length.
Definition integer_sequence.hpp:230
constexpr bool is_nothrow_default_constructible_v
Type trait to detect if an instance of T is default constructible without throwing.
constexpr auto forward(remove_reference_t< T > &value) noexcept -> T &&
Cast a value to an rvalue if T is an rvalue or rvalue reference, otherwise forward an lvalue referenc...
Definition forward.hpp:24
auto operator>(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if one iterator is greater than another.
Definition move_iterator.hpp:305
Tag type for piecewise construction.
Definition pair.hpp:39