#include <muu/compressed_pair.h>
template <typename First, typename Second>
compressed_pair class
A pair that uses Empty Base Class Optimization to elide storage for one or both of its members where possible.
Template parameters | |
---|---|
First | First member type. |
Second | Second member type. |
Public types
- using first_type = First
- The pair's first member type.
- using second_type = Second
- The pair's second member type.
Constructors, destructors, conversion operators
- compressed_pair() defaulted
- Default constructor.
-
compressed_pair(const compressed_
pair&) defaulted - Copy constructor.
-
compressed_pair(compressed_
pair&&) defaulted - Move constructor.
-
template <typename F, typename S>compressed_pair(F&& first_init, S&& second_init) constexpr noexcept(…)
- Constructs a compressed pair from two values.
Public functions
-
auto first() & -> first_
type& constexpr noexcept - Returns an lvalue reference to the first member.
-
auto first() && -> first_
type&& constexpr noexcept - Returns an rvalue reference to the first member.
-
auto first() const & -> constfirst_
type& constexpr noexcept - Returns a const lvalue reference to the first member.
-
auto first() const && -> constfirst_
type&& constexpr noexcept - Returns a const rvalue reference to the first member.
-
template <size_t I>auto get() & -> auto& constexpr noexcept
- Returns an lvalue reference to the selected member.
-
template <size_t I>auto get() && -> auto&& constexpr noexcept
- Returns an rvalue reference to the selected member.
-
template <size_t I>auto get() const & -> const auto& constexpr noexcept
- Returns a const lvalue reference to the selected member.
-
template <size_t I>auto get() const && -> const auto&& constexpr noexcept
- Returns a const rvalue reference to the selected member.
-
auto operator=(const compressed_
pair&) -> compressed_ pair& defaulted - Copy-assignment operator.
-
auto operator=(compressed_
pair&&) -> compressed_ pair& defaulted - Move-assignment operator.
-
auto second() & -> second_
type& constexpr noexcept - Returns an lvalue reference to the second member.
-
auto second() && -> second_
type&& constexpr noexcept - Returns an rvalue reference to the second member.
-
auto second() const & -> constsecond_
type& constexpr noexcept - Returns a const lvalue reference to the second member.
-
auto second() const && -> constsecond_
type&& constexpr noexcept - Returns a const rvalue reference to the second member.
-
void swap(compressed_
pair& other) noexcept(…) - Swaps two pairs.
Function documentation
template <typename First, typename Second>
template <typename F, typename S>
muu::compressed_pair::compressed_pair(F&& first_init,
S&& second_init) constexpr noexcept(…)
template <typename F, typename S>
Constructs a compressed pair from two values.
Template parameters | |
---|---|
F | First member initializer type. |
S | Second member initializer type. |
Parameters | |
first_init | First member initializer. |
second_init | Second member initializer. |
template <typename First, typename Second>
void muu::compressed_pair::swap(compressed_ pair& other) noexcept(…)
Swaps two pairs.