Subclause | Header | ||
Utility components | <utility> | ||
Pairs | |||
Tuples | <tuple> | ||
Optional objects | <optional> | ||
Variants | <variant> | ||
Storage for any type | <any> | ||
Expected objects | <expected> | ||
Fixed-size sequences of bits | <bitset> | ||
Function objects | <functional> | ||
Type indexes | <typeindex> | ||
Execution policies | <execution> | ||
Primitive numeric conversions | <charconv> | ||
Formatting | <format> | ||
Bit manipulation | <bit> | ||
Debugging | <debugging> |
template<class T>
constexpr void swap(T& a, T& b) noexcept(see below);
template<class T, size_t N>
constexpr void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
template<class T, class U = T>
constexpr T exchange(T& obj, U&& new_val) noexcept(see below);
template<class T> constexpr T&& forward(remove_reference_t<T>& t) noexcept;
template<class T> constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
template<class T, class U>
constexpr auto forward_like(U&& x) noexcept -> see below;
template<class T> constexpr remove_reference_t<T>&& move(T&& t) noexcept;
template<class T> constexpr conditional_t<
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>, const T&, T&&>
move_if_noexcept(T& x) noexcept;
template<class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
template<class T> add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
template<class T, class U>
constexpr bool cmp_equal(T t, U u) noexcept;
template<class T, class U>
constexpr bool cmp_not_equal(T t, U u) noexcept;
template<class T, class U>
constexpr bool cmp_less(T t, U u) noexcept;
template<class T, class U>
constexpr bool cmp_greater(T t, U u) noexcept;
template<class T, class U>
constexpr bool cmp_less_equal(T t, U u) noexcept;
template<class T, class U>
constexpr bool cmp_greater_equal(T t, U u) noexcept;
template<class R, class T>
constexpr bool in_range(T t) noexcept;
template<class T>
constexpr underlying_type_t<T> to_underlying(T value) noexcept;
constexpr explicit(see below) pair();
constexpr explicit(see below) pair(const T1& x, const T2& y);
template<class U1 = T1, class U2 = T2> constexpr explicit(see below) pair(U1&& x, U2&& y);
template<class U1, class U2> constexpr explicit(see below) pair(pair<U1, U2>& p);
template<class U1, class U2> constexpr explicit(see below) pair(const pair<U1, U2>& p);
template<class U1, class U2> constexpr explicit(see below) pair(pair<U1, U2>&& p);
template<class U1, class U2> constexpr explicit(see below) pair(const pair<U1, U2>&& p);
template<pair-like P> constexpr explicit(see below) pair(P&& p);
template<class... Args1, class... Args2>
constexpr pair(piecewise_construct_t,
tuple<Args1...> first_args, tuple<Args2...> second_args);
constexpr pair& operator=(const pair& p);
constexpr const pair& operator=(const pair& p) const;
template<class U1, class U2> constexpr pair& operator=(const pair<U1, U2>& p);
template<class U1, class U2> constexpr const pair& operator=(const pair<U1, U2>& p) const;
constexpr pair& operator=(pair&& p) noexcept(see below);
constexpr const pair& operator=(pair&& p) const;
template<class U1, class U2> constexpr pair& operator=(pair<U1, U2>&& p);
template<class U1, class U2> constexpr const pair& operator=(pair<U1, U2>&& p) const;
constexpr void swap(pair& p) noexcept(see below);
constexpr void swap(const pair& p) const noexcept(see below);
template<class T1, class T2, class U1, class U2>
constexpr bool operator==(const pair<T1, T2>& x, const pair<U1, U2>& y);
template<class T1, class T2, class U1, class U2>
constexpr common_comparison_category_t<synth-three-way-result<T1, U1>,
synth-three-way-result<T2, U2>>
operator<=>(const pair<T1, T2>& x, const pair<U1, U2>& y);
template<class T1, class T2>
constexpr void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
template<class T1, class T2>
constexpr void swap(const pair<T1, T2>& x, const pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
template<class T1, class T2>
constexpr pair<unwrap_ref_decay_t<T1>, unwrap_ref_decay_t<T2>> make_pair(T1&& x, T2&& y);
template<class T1, class T2>
struct tuple_size<pair<T1, T2>> : integral_constant<size_t, 2> { };
template<size_t I, class T1, class T2>
struct tuple_element<I, pair<T1, T2>> {
using type = see below ;
};
template<size_t I, class T1, class T2>
constexpr tuple_element_t<I, pair<T1, T2>>& get(pair<T1, T2>& p) noexcept;
template<size_t I, class T1, class T2>
constexpr const tuple_element_t<I, pair<T1, T2>>& get(const pair<T1, T2>& p) noexcept;
template<size_t I, class T1, class T2>
constexpr tuple_element_t<I, pair<T1, T2>>&& get(pair<T1, T2>&& p) noexcept;
template<size_t I, class T1, class T2>
constexpr const tuple_element_t<I, pair<T1, T2>>&& get(const pair<T1, T2>&& p) noexcept;
template<class T1, class T2>
constexpr T1& get(pair<T1, T2>& p) noexcept;
template<class T1, class T2>
constexpr const T1& get(const pair<T1, T2>& p) noexcept;
template<class T1, class T2>
constexpr T1&& get(pair<T1, T2>&& p) noexcept;
template<class T1, class T2>
constexpr const T1&& get(const pair<T1, T2>&& p) noexcept;
template<class T2, class T1>
constexpr T2& get(pair<T1, T2>& p) noexcept;
template<class T2, class T1>
constexpr const T2& get(const pair<T1, T2>& p) noexcept;
template<class T2, class T1>
constexpr T2&& get(pair<T1, T2>&& p) noexcept;
template<class T2, class T1>
constexpr const T2&& get(const pair<T1, T2>&& p) noexcept;
struct piecewise_construct_t {
explicit piecewise_construct_t() = default;
};
inline constexpr piecewise_construct_t piecewise_construct{};
template<class T>
concept tuple-like = see below; // exposition only
constexpr explicit(see below) tuple();
constexpr explicit(see below) tuple(const Types&...);
template<class... UTypes> constexpr explicit(see below) tuple(UTypes&&... u);
tuple(const tuple& u) = default;
tuple(tuple&& u) = default;
template<class... UTypes> constexpr explicit(see below) tuple(tuple<UTypes...>& u);
template<class... UTypes> constexpr explicit(see below) tuple(const tuple<UTypes...>& u);
template<class... UTypes> constexpr explicit(see below) tuple(tuple<UTypes...>&& u);
template<class... UTypes> constexpr explicit(see below) tuple(const tuple<UTypes...>&& u);
template<class U1, class U2> constexpr explicit(see below) tuple(pair<U1, U2>& u);
template<class U1, class U2> constexpr explicit(see below) tuple(const pair<U1, U2>& u);
template<class U1, class U2> constexpr explicit(see below) tuple(pair<U1, U2>&& u);
template<class U1, class U2> constexpr explicit(see below) tuple(const pair<U1, U2>&& u);
template<tuple-like UTuple>
constexpr explicit(see below) tuple(UTuple&& u);
template<class Alloc>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a);
template<class Alloc>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, const Types&...);
template<class Alloc, class... UTypes>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, UTypes&&...);
template<class Alloc>
constexpr tuple(allocator_arg_t, const Alloc& a, const tuple&);
template<class Alloc>
constexpr tuple(allocator_arg_t, const Alloc& a, tuple&&);
template<class Alloc, class... UTypes>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&);
template<class Alloc, class... UTypes>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&);
template<class Alloc, class... UTypes>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
template<class Alloc, class... UTypes>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&&);
template<class Alloc, class U1, class U2>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&);
template<class Alloc, class U1, class U2>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
template<class Alloc, class U1, class U2>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
template<class Alloc, class U1, class U2>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&&);
template<class Alloc, tuple-like UTuple>
constexpr explicit(see below)
tuple(allocator_arg_t, const Alloc& a, UTuple&&);
constexpr tuple& operator=(const tuple& u);
constexpr const tuple& operator=(const tuple& u) const;
constexpr tuple& operator=(tuple&& u) noexcept(see below);
constexpr const tuple& operator=(tuple&& u) const;
template<class... UTypes> constexpr tuple& operator=(const tuple<UTypes...>& u);
template<class... UTypes> constexpr const tuple& operator=(const tuple<UTypes...>& u) const;
template<class... UTypes> constexpr tuple& operator=(tuple<UTypes...>&& u);
template<class... UTypes> constexpr const tuple& operator=(tuple<UTypes...>&& u) const;
template<class U1, class U2> constexpr tuple& operator=(const pair<U1, U2>& u);
template<class U1, class U2> constexpr const tuple& operator=(const pair<U1, U2>& u) const;
template<class U1, class U2> constexpr tuple& operator=(pair<U1, U2>&& u);
template<class U1, class U2> constexpr const tuple& operator=(pair<U1, U2>&& u) const;
template<tuple-like UTuple>
constexpr tuple& operator=(UTuple&& u);
template<tuple-like UTuple>
constexpr const tuple& operator=(UTuple&& u) const;
constexpr void swap(tuple& rhs) noexcept(see below);
constexpr void swap(const tuple& rhs) const noexcept(see below);
template<class... TTypes>
constexpr tuple<unwrap_ref_decay_t<TTypes>...> make_tuple(TTypes&&... t);
template<class... TTypes>
constexpr tuple<TTypes&&...> forward_as_tuple(TTypes&&... t) noexcept;
template<class... TTypes>
constexpr tuple<TTypes&...> tie(TTypes&... t) noexcept;
template<tuple-like... Tuples>
constexpr tuple<CTypes...> tuple_cat(Tuples&&... tpls);
template<class F, tuple-like Tuple>
constexpr decltype(auto) apply(F&& f, Tuple&& t) noexcept(see below);
template<class T, tuple-like Tuple>
constexpr T make_from_tuple(Tuple&& t);
template<class T> struct tuple_size;
template<class... Types>
struct tuple_size<tuple<Types...>> : public integral_constant<size_t, sizeof...(Types)> { };
template<size_t I, class... Types>
struct tuple_element<I, tuple<Types...>> {
using type = TI;
};
template<class T> struct tuple_size<const T>;
template<size_t I, class T> struct tuple_element<I, const T>;
template<size_t I, class... Types>
constexpr tuple_element_t<I, tuple<Types...>>&
get(tuple<Types...>& t) noexcept;
template<size_t I, class... Types>
constexpr tuple_element_t<I, tuple<Types...>>&&
get(tuple<Types...>&& t) noexcept; // #1
template<size_t I, class... Types>
constexpr const tuple_element_t<I, tuple<Types...>>&
get(const tuple<Types...>& t) noexcept; // #2
template<size_t I, class... Types>
constexpr const tuple_element_t<I, tuple<Types...>>&& get(const tuple<Types...>&& t) noexcept;
template<class T, class... Types>
constexpr T& get(tuple<Types...>& t) noexcept;
template<class T, class... Types>
constexpr T&& get(tuple<Types...>&& t) noexcept;
template<class T, class... Types>
constexpr const T& get(const tuple<Types...>& t) noexcept;
template<class T, class... Types>
constexpr const T&& get(const tuple<Types...>&& t) noexcept;
template<class... TTypes, class... UTypes>
constexpr bool operator==(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
template<class... TTypes, tuple-like UTuple>
constexpr bool operator==(const tuple<TTypes...>& t, const UTuple& u);
template<class... TTypes, class... UTypes>
constexpr common_comparison_category_t<synth-three-way-result<TTypes, UTypes>...>
operator<=>(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
template<class... TTypes, tuple-like UTuple>
constexpr common_comparison_category_t<synth-three-way-result<TTypes, Elems>...>
operator<=>(const tuple<TTypes...>& t, const UTuple& u);
template<tuple-like TTuple, tuple-like UTuple,
template<class> class TQual, template<class> class UQual>
struct basic_common_reference<TTuple, UTuple, TQual, UQual> {
using type = see below;
};
template<tuple-like TTuple, tuple-like UTuple>
struct common_type<TTuple, UTuple> {
using type = see below;
};
template<class... Types, class Alloc>
struct uses_allocator<tuple<Types...>, Alloc> : true_type { };
template<class... Types>
constexpr void swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(see below);
template<class... Types>
constexpr void swap(const tuple<Types...>& x, const tuple<Types...>& y) noexcept(see below);
constexpr optional() noexcept;
constexpr optional(nullopt_t) noexcept;
constexpr optional(const optional& rhs);
constexpr optional(optional&& rhs) noexcept(see below);
template<class... Args> constexpr explicit optional(in_place_t, Args&&... args);
template<class U, class... Args>
constexpr explicit optional(in_place_t, initializer_list<U> il, Args&&... args);
template<class U = T> constexpr explicit(see below) optional(U&& v);
template<class U> constexpr explicit(see below) optional(const optional<U>& rhs);
template<class U> constexpr explicit(see below) optional(optional<U>&& rhs);
constexpr ~optional();
constexpr optional<T>& operator=(nullopt_t) noexcept;
constexpr optional<T>& operator=(const optional& rhs);
*this contains a value | *this does not contain a value | |||
rhs contains a value | assigns *rhs to the contained value | direct-non-list-initializes the contained value with *rhs | ||
rhs does not contain a value | destroys the contained value by calling val->T::~T() | no effect |
constexpr optional& operator=(optional&& rhs) noexcept(see below);
*this contains a value | *this does not contain a value | |||
rhs contains a value | assigns std::move(*rhs) to the contained value | direct-non-list-initializes the contained value with std::move(*rhs) | ||
rhs does not contain a value | destroys the contained value by calling val->T::~T() | no effect |
template<class U = T> constexpr optional<T>& operator=(U&& v);
template<class U> constexpr optional<T>& operator=(const optional<U>& rhs);
*this contains a value | *this does not contain a value | |||
rhs contains a value | assigns *rhs to the contained value | direct-non-list-initializes the contained value with *rhs | ||
rhs does not contain a value | destroys the contained value by calling val->T::~T() | no effect |
template<class U> constexpr optional<T>& operator=(optional<U>&& rhs);
*this contains a value | *this does not contain a value | |||
rhs contains a value | assigns std::move(*rhs) to the contained value | direct-non-list-initializes the contained value with std::move(*rhs) | ||
rhs does not contain a value | destroys the contained value by calling val->T::~T() | no effect |
template<class... Args> constexpr T& emplace(Args&&... args);
template<class U, class... Args> constexpr T& emplace(initializer_list<U> il, Args&&... args);
constexpr void swap(optional& rhs) noexcept(see below);
*this contains a value | *this does not contain a value | |||
rhs contains a value | calls swap(*(*this), *rhs) | direct-non-list-initializes the contained value of *this
with std::move(*rhs),
followed by rhs.val->T::~T();
postcondition is that *this contains a value and rhs does not contain a value | ||
rhs does not contain a value | direct-non-list-initializes the contained value of rhs
with std::move(*(*this)),
followed by val->T::~T();
postcondition is that *this does not contain a value and rhs contains a value | no effect |
using iterator = implementation-defined;
using const_iterator = implementation-defined;
constexpr iterator begin() noexcept;
constexpr const_iterator begin() const noexcept;
constexpr iterator end() noexcept;
constexpr const_iterator end() const noexcept;
constexpr const T* operator->() const noexcept;
constexpr T* operator->() noexcept;
constexpr const T& operator*() const & noexcept;
constexpr T& operator*() & noexcept;
constexpr T&& operator*() && noexcept;
constexpr const T&& operator*() const && noexcept;
constexpr explicit operator bool() const noexcept;
constexpr bool has_value() const noexcept;
constexpr const T& value() const &;
constexpr T& value() &;
constexpr T&& value() &&;
constexpr const T&& value() const &&;
template<class U> constexpr T value_or(U&& v) const &;
template<class U> constexpr T value_or(U&& v) &&;
template<class F> constexpr auto and_then(F&& f) &;
template<class F> constexpr auto and_then(F&& f) const &;
template<class F> constexpr auto and_then(F&& f) &&;
template<class F> constexpr auto and_then(F&& f) const &&;
template<class F> constexpr auto transform(F&& f) &;
template<class F> constexpr auto transform(F&& f) const &;
template<class F> constexpr auto transform(F&& f) &&;
template<class F> constexpr auto transform(F&& f) const &&;
template<class F> constexpr optional or_else(F&& f) const &;
template<class F> constexpr optional or_else(F&& f) &&;
struct nullopt_t{see below};
inline constexpr nullopt_t nullopt(unspecified);
const char* what() const noexcept override;
template<class T, class U> constexpr bool operator==(const optional<T>& x, const optional<U>& y);
template<class T, class U> constexpr bool operator!=(const optional<T>& x, const optional<U>& y);
template<class T, class U> constexpr bool operator<(const optional<T>& x, const optional<U>& y);
template<class T, class U> constexpr bool operator>(const optional<T>& x, const optional<U>& y);
template<class T, class U> constexpr bool operator<=(const optional<T>& x, const optional<U>& y);
template<class T, class U> constexpr bool operator>=(const optional<T>& x, const optional<U>& y);
template<class T, three_way_comparable_with<T> U>
constexpr compare_three_way_result_t<T, U>
operator<=>(const optional<T>& x, const optional<U>& y);
template<class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept;
template<class T> constexpr strong_ordering operator<=>(const optional<T>& x, nullopt_t) noexcept;
template<class T, class U> constexpr bool operator==(const optional<T>& x, const U& v);
template<class T, class U> constexpr bool operator==(const T& v, const optional<U>& x);
template<class T, class U> constexpr bool operator!=(const optional<T>& x, const U& v);
template<class T, class U> constexpr bool operator!=(const T& v, const optional<U>& x);
template<class T, class U> constexpr bool operator<(const optional<T>& x, const U& v);
template<class T, class U> constexpr bool operator<(const T& v, const optional<U>& x);
template<class T, class U> constexpr bool operator>(const optional<T>& x, const U& v);
template<class T, class U> constexpr bool operator>(const T& v, const optional<U>& x);
template<class T, class U> constexpr bool operator<=(const optional<T>& x, const U& v);
template<class T, class U> constexpr bool operator<=(const T& v, const optional<U>& x);
template<class T, class U> constexpr bool operator>=(const optional<T>& x, const U& v);
template<class T, class U> constexpr bool operator>=(const T& v, const optional<U>& x);
template<class T, class U>
requires (!is-derived-from-optional<U>) && three_way_comparable_with<T, U>
constexpr compare_three_way_result_t<T, U>
operator<=>(const optional<T>& x, const U& v);
template<class T>
constexpr void swap(optional<T>& x, optional<T>& y) noexcept(noexcept(x.swap(y)));
template<class T> constexpr optional<decay_t<T>> make_optional(T&& v);
template<class T, class...Args>
constexpr optional<T> make_optional(Args&&... args);
template<class T, class U, class... Args>
constexpr optional<T> make_optional(initializer_list<U> il, Args&&... args);
template<class T> struct hash<optional<T>>;
constexpr variant() noexcept(see below);
constexpr variant(const variant& w);
constexpr variant(variant&& w) noexcept(see below);
template<class T> constexpr variant(T&& t) noexcept(see below);
template<class T, class... Args> constexpr explicit variant(in_place_type_t<T>, Args&&... args);
template<class T, class U, class... Args>
constexpr explicit variant(in_place_type_t<T>, initializer_list<U> il, Args&&... args);
template<size_t I, class... Args> constexpr explicit variant(in_place_index_t<I>, Args&&... args);