std::pair whose members keep their own Safe storage. More...
#include <StormByte/safe/pair.hxx>

Public Types | |
| using | first_type = First |
| First member type. | |
| using | second_type = Second |
| Second member type. | |
Public Member Functions | |
| Pair () | |
| Value-initialize both members. | |
| Pair (const First &firstValue, const Second &secondValue) | |
| Copy two values into the pair. | |
| Pair (First &&firstValue, Second &&secondValue) noexcept(std::is_nothrow_move_constructible_v< First > &&std::is_nothrow_move_constructible_v< Second >) | |
| Move two values into the pair. | |
| template<class U, class V> requires Type::ConstructibleFrom<First, U> && Type::ConstructibleFrom<Second, V> | |
| Pair (U &&firstValue, V &&secondValue) | |
| Construct both members from convertible values. | |
| template<class... FirstArgs, class... SecondArgs> | |
| Pair (std::piecewise_construct_t tag, std::tuple< FirstArgs... > firstArgs, std::tuple< SecondArgs... > secondArgs) | |
| Construct both members from argument tuples. | |
| template<class OtherFirst, class OtherSecond> requires Type::ConstructibleFrom<First, const OtherFirst&> && Type::ConstructibleFrom<Second, const OtherSecond&> | |
| Pair (const std::pair< OtherFirst, OtherSecond > &other) | |
| Copy a caller-owned STL pair. | |
| template<class OtherFirst, class OtherSecond> requires Type::ConstructibleFrom<First, OtherFirst> && Type::ConstructibleFrom<Second, OtherSecond> | |
| Pair (std::pair< OtherFirst, OtherSecond > &&other) | |
| Move a caller-owned STL pair. | |
| template<class OtherFirst, class OtherSecond> requires Type::ConstructibleFrom<First, const OtherFirst&> && Type::ConstructibleFrom<Second, const OtherSecond&> | |
| Pair (const Pair< OtherFirst, OtherSecond > &other) | |
| Copy a compatible Safe pair. | |
| template<class OtherFirst, class OtherSecond> requires Type::ConstructibleFrom<First, OtherFirst> && Type::ConstructibleFrom<Second, OtherSecond> | |
| Pair (Pair< OtherFirst, OtherSecond > &&other) | |
| Move a compatible Safe pair. | |
| Pair (const Pair &other)=default | |
| Copy a pair. | |
| Pair (Pair &&other) noexcept(std::is_nothrow_move_constructible_v< First > &&std::is_nothrow_move_constructible_v< Second >)=default | |
| Move a pair. | |
| ~Pair ()=default | |
| Destroy both members through their own Safe operations. | |
| Pair & | operator= (const Pair &other)=default |
| Copy-assign a pair. | |
| Pair & | operator= (Pair &&other) noexcept(std::is_nothrow_move_assignable_v< First > &&std::is_nothrow_move_assignable_v< Second >)=default |
| Move-assign a pair. | |
| template<class OtherFirst, class OtherSecond> requires Type::AssignableFrom<First&, const OtherFirst&> && Type::AssignableFrom<Second&, const OtherSecond&> | |
| Pair & | operator= (const Pair< OtherFirst, OtherSecond > &other) |
| Copy-assign a compatible Safe pair. | |
| template<class OtherFirst, class OtherSecond> requires Type::AssignableFrom<First&, OtherFirst> && Type::AssignableFrom<Second&, OtherSecond> | |
| Pair & | operator= (Pair< OtherFirst, OtherSecond > &&other) |
| Move-assign a compatible Safe pair. | |
| template<class OtherFirst, class OtherSecond> requires Type::AssignableFrom<First&, const OtherFirst&> && Type::AssignableFrom<Second&, const OtherSecond&> | |
| Pair & | operator= (const std::pair< OtherFirst, OtherSecond > &other) |
| Copy-assign a caller-owned STL pair. | |
| template<class OtherFirst, class OtherSecond> requires Type::AssignableFrom<First&, OtherFirst> && Type::AssignableFrom<Second&, OtherSecond> | |
| Pair & | operator= (std::pair< OtherFirst, OtherSecond > &&other) |
| Move-assign a caller-owned STL pair. | |
| void | swap (Pair &other) noexcept(Type::Swappable< First > &&Type::Swappable< Second >) |
| Exchange both members. | |
| bool | operator== (const Pair &other) const |
| Compare both members. | |
| STORMBYTE_FORCE_INLINE auto | operator<=> (const Pair &other) const |
| Order by the first member, then the second. | |
| STORMBYTE_FORCE_INLINE | operator std::pair< First, Second > () const |
| Copy the members into caller-owned STL storage. | |
Public Attributes | |
| First | first |
| First value. | |
| Second | second |
| Second value. | |
Friends | |
| void | swap (Pair &left, Pair &right) noexcept(noexcept(left.swap(right))) |
| Exchange two pairs. | |
std::pair whose members keep their own Safe storage.
The pair allocates nothing. Copy, move and destruction of each member run through that member's Safe operations, so the pair may be created or destroyed in a consumer module.
| using StormByte::Safe::Pair< First, Second >::first_type = First |
First member type.
| using StormByte::Safe::Pair< First, Second >::second_type = Second |
Second member type.
|
inline |
Value-initialize both members.
| StormByte::Safe::Pair< First, Second >::Pair | ( | const First & | firstValue, |
| const Second & | secondValue ) |
Copy two values into the pair.
| firstValue | Initial first value. |
| secondValue | Initial second value. |
|
noexcept |
Move two values into the pair.
| firstValue | Initial first value. |
| secondValue | Initial second value. |
| StormByte::Safe::Pair< First, Second >::Pair | ( | U && | firstValue, |
| V && | secondValue ) |
Construct both members from convertible values.
| U | First source type. |
| V | Second source type. |
| firstValue | Initial first value. |
| secondValue | Initial second value. |
| StormByte::Safe::Pair< First, Second >::Pair | ( | std::piecewise_construct_t | tag, |
| std::tuple< FirstArgs... > | firstArgs, | ||
| std::tuple< SecondArgs... > | secondArgs ) |
Construct both members from argument tuples.
| FirstArgs | First constructor argument types. |
| SecondArgs | Second constructor argument types. |
| tag | Piecewise construction tag. |
| firstArgs | Arguments for the first member. |
| secondArgs | Arguments for the second member. |
| StormByte::Safe::Pair< First, Second >::Pair | ( | const std::pair< OtherFirst, OtherSecond > & | other | ) |
Copy a caller-owned STL pair.
Its state is unchanged.
| OtherFirst | Source first type. |
| OtherSecond | Source second type. |
| other | Source pair. |
| StormByte::Safe::Pair< First, Second >::Pair | ( | std::pair< OtherFirst, OtherSecond > && | other | ) |
Move a caller-owned STL pair.
The source members are moved-from.
| OtherFirst | Source first type. |
| OtherSecond | Source second type. |
| other | Source pair. |
| StormByte::Safe::Pair< First, Second >::Pair | ( | const Pair< OtherFirst, OtherSecond > & | other | ) |
Copy a compatible Safe pair.
| OtherFirst | Source first type. |
| OtherSecond | Source second type. |
| other | Source pair. |
| StormByte::Safe::Pair< First, Second >::Pair | ( | Pair< OtherFirst, OtherSecond > && | other | ) |
Move a compatible Safe pair.
| OtherFirst | Source first type. |
| OtherSecond | Source second type. |
| other | Source pair. |
|
default |
Copy a pair.
| other | Source pair. |
|
defaultnoexcept |
Move a pair.
| other | Source pair. |
|
default |
Destroy both members through their own Safe operations.
|
inlineexplicit |
Copy the members into caller-owned STL storage.
| STORMBYTE_FORCE_INLINE auto StormByte::Safe::Pair< First, Second >::operator<=> | ( | const Pair< First, Second > & | other | ) | const |
Order by the first member, then the second.
| other | Pair to compare. |
|
default |
Copy-assign a pair.
| other | Source pair. |
| Pair & StormByte::Safe::Pair< First, Second >::operator= | ( | const Pair< OtherFirst, OtherSecond > & | other | ) |
Copy-assign a compatible Safe pair.
| OtherFirst | Source first type. |
| OtherSecond | Source second type. |
| other | Source pair. |
| Pair & StormByte::Safe::Pair< First, Second >::operator= | ( | const std::pair< OtherFirst, OtherSecond > & | other | ) |
Copy-assign a caller-owned STL pair.
Its state is unchanged.
| OtherFirst | Source first type. |
| OtherSecond | Source second type. |
| other | Source pair. |
|
defaultnoexcept |
Move-assign a pair.
| other | Source pair. |
| Pair & StormByte::Safe::Pair< First, Second >::operator= | ( | Pair< OtherFirst, OtherSecond > && | other | ) |
Move-assign a compatible Safe pair.
| OtherFirst | Source first type. |
| OtherSecond | Source second type. |
| other | Source pair. |
| Pair & StormByte::Safe::Pair< First, Second >::operator= | ( | std::pair< OtherFirst, OtherSecond > && | other | ) |
Move-assign a caller-owned STL pair.
| OtherFirst | Source first type. |
| OtherSecond | Source second type. |
| other | Source pair. |
| bool StormByte::Safe::Pair< First, Second >::operator== | ( | const Pair< First, Second > & | other | ) | const |
|
noexcept |
Exchange both members.
| other | Pair to exchange with. |
|
friend |
Exchange two pairs.
| left | First pair. |
| right | Second pair. |
| First StormByte::Safe::Pair< First, Second >::first |
First value.
| Second StormByte::Safe::Pair< First, Second >::second |
Second value.