#include <bn_utility.h>
template<typename Type1, typename Type2>
pair class
Provides a way to store two heterogeneous objects as a single unit.
| Template parameters | |
|---|---|
| Type1 | First element type. |
| Type2 | Second element type. |
Contents
Public types
- using first_type = Type1
- First element type alias.
- using second_type = Type2
- Second element type alias.
Constructors, destructors, conversion operators
- pair() defaulted constexpr
- Default constructor.
-
pair(const first_
type& x, const second_ type& y) constexpr - Initializes first with x and second with y.
-
template<typename OtherType1, typename OtherType2>pair(OtherType1&& x, OtherType2&& y) constexpr
- Initializes first with forward<OtherType1>(x) and second with forward<OtherType2>(y).
- pair(const pair& other) defaulted constexpr
- Default copy constructor.
-
template<typename OtherType1, typename OtherType2>pair(const pair<OtherType1, OtherType2>& other) constexpr
- Initializes first with other.first and second with other.second.
- pair(pair&& other) defaulted constexpr
- Default move constructor.
-
template<typename OtherType1, typename OtherType2>pair(pair<OtherType1, OtherType2>&& other) constexpr
- Initializes first with move(other.first) and second with move(other.second).
Public functions
- auto operator=(const pair& other) -> pair& defaulted constexpr
- Default copy assignment operator.
-
template<typename OtherType1, typename OtherType2>auto operator=(const pair<OtherType1, OtherType2>& other) -> pair& constexpr
- Assigns other.first to first and other.second to second.
- auto operator=(pair&& other) -> pair& defaulted constexpr
- Default move assignment operator.
-
template<typename OtherType1, typename OtherType2>auto operator=(pair<OtherType1, OtherType2>&& other) -> pair& constexpr
- Assigns move(other.first) to first and move(other.second) to second.
- void swap(pair& other) constexpr
- Exchanges the contents of this pair with those of the other one.
Public variables
-
first_
type first - First element.
-
second_
type second - Second element.