#include <Containers/Pair.h>
template<class, class>
Pair class
Pair of values.
An alternative to std::constexpr
contexts even in C++11. On the other hand, to simplify both the implementation and usage semantics, the type doesn't support references — wrap them in a Reference in order to store them in a Pair. Such type composition allows you to both rebind the reference and update the referenced value and the intent is clear.
Similarly to other containers and equivalently to std::
Public types
- using FirstType = F
- using SecondType = S
Constructors, destructors, conversion operators
- Pair(DefaultInitT) explicit constexpr noexcept(…)
- Construct a default-initialized pair.
- Pair(ValueInitT) explicit constexpr noexcept(…)
- Construct a value-initialized pair.
- Pair(NoInitT) explicit noexcept(…)
- Construct a pair without initializing its contents.
- Pair() constexpr noexcept(…)
- Default constructor.
- Pair(const F& first, const S& second) constexpr noexcept(…)
- Constructor.
- Pair(const F& first, S&& second) constexpr noexcept(…)
- Pair(F&& first, const S& second) constexpr noexcept(…)
- Pair(F&& first, S&& second) constexpr noexcept(…)
-
template<class OtherF, class OtherS, class = typename std::Pair(const Pair<OtherF, OtherS>& other) explicit constexpr noexcept(…)
enable_if<std:: is_constructible<F, const OtherF&>::value&& std:: is_constructible<S, const OtherS&>::value>::type> - Copy-construct a pair from another of different type.
-
template<class OtherF, class OtherS, class = typename std::Pair(Pair<OtherF, OtherS>&& other) explicit constexpr noexcept(…)
enable_if<std:: is_constructible<F, OtherF && >::value&& std:: is_constructible<S, OtherS && >::value>::type> - Move-construct a pair from another of different type.
-
template<class T, class = decltype(Implementation::PairConverter<F, S, T>::from(std::Pair(const T& other) noexcept(…)
declval<const T&>()))> - Copy-construct a pair from external representation.
-
template<class T, class = decltype(Implementation::PairConverter<F, S, T>::from(std::Pair(T&& other) noexcept(…)
declval<T && >()))> - Move-construct a pair from external representation.
-
template<class T, class = decltype(Implementation::PairConverter<F, S, T>::to(std::operator T() const &
declval<const Pair<F, S>&>()))> - Copy-convert the pair to external representation.
-
template<class T, class = decltype(Implementation::PairConverter<F, S, T>::to(std::operator T() &&
declval<Pair<F, S> && >()))> - Move-convert the pair to external representation.
Public functions
- auto operator==(const Pair<F, S>& other) const -> bool constexpr
- Equality comparison.
- auto operator!=(const Pair<F, S>& other) const -> bool constexpr
- Non-equality comparison.
- auto first() & -> F& constexpr
- First element.
- auto first() && -> F constexpr
- auto first() const & -> const F& constexpr
- auto second() & -> S& constexpr
- Second element.
- auto second() && -> S constexpr
- auto second() const & -> const S& constexpr
Function documentation
template<class _1, class _2>
Death:: Containers:: Pair<_1, _2>:: Pair(DefaultInitT) explicit constexpr noexcept(…)
Construct a default-initialized pair.
Trivial types are not initialized, default constructor called otherwise. Because of the differing behavior for trivial types it's better to explicitly use either the Pair(ValueInitT) or the Pair(NoInitT) variant instead.
template<class _1, class _2>
Death:: Containers:: Pair<_1, _2>:: Pair(ValueInitT) explicit constexpr noexcept(…)
Construct a value-initialized pair.
Trivial types are zero-initialized, default constructor called otherwise. This is the same as the default constructor.
template<class _1, class _2>
Death:: Containers:: Pair<_1, _2>:: Pair(NoInitT) explicit noexcept(…)
Construct a pair without initializing its contents.
Enabled only for trivial types and types that implement the NoInit constructor. The contents are not initialized. Useful if you will be overwriting both members later anyway or if you need to initialize in a way that's not expressible via any other Pair constructor.
For trivial types is equivalent to Pair(DefaultInitT).
template<class _1, class _2>
Death:: Containers:: Pair<_1, _2>:: Pair() constexpr noexcept(…)
Default constructor.
Alias to Pair(ValueInitT).
template<class _1, class _2>
Death:: Containers:: Pair<_1, _2>:: Pair(const F& first,
S&& second) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class _1, class _2>
Death:: Containers:: Pair<_1, _2>:: Pair(F&& first,
const S& second) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class _1, class _2>
Death:: Containers:: Pair<_1, _2>:: Pair(F&& first,
S&& second) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class _1, class _2>
F Death:: Containers:: Pair<_1, _2>:: first() && constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class _1, class _2>
const F& Death:: Containers:: Pair<_1, _2>:: first() const & constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class _1, class _2>
S Death:: Containers:: Pair<_1, _2>:: second() && constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class _1, class _2>
const S& Death:: Containers:: Pair<_1, _2>:: second() const & constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class _1, class _2>
template<class F, class S>
Pair<typename std:: decay<F>::type, typename std:: decay<S>::type> pair(F&& first,
S&& second) constexpr
Make a pair.
Convernience alternative to Pair::