A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../error/../language/../utility/pair.html below:

std::pair - cppreference.com

template<

    class T1,
    class T2

> struct pair;

std::pair is a class template that provides a way to store two heterogeneous objects as a single unit. A pair is a specific case of a std::tuple with two elements.

If neither T1 nor T2 is a possibly cv-qualified class type with non-trivial destructor, or array thereof, the destructor of pair is trivial.

[edit] Template parameters T1, T2 - the types of the elements that the pair stores. [edit] Member types Member type Definition first_type T1 second_type T2 [edit] Member objects Member name Type first T1 second T2 [edit] Member functions [edit] Non-member functions [edit] Helper classes [edit] Helper specializations template< class T, class U >

constexpr bool enable_nonlocking_formatter_optimization<std::pair<T, U>> =
    enable_nonlocking_formatter_optimization<T> &&

    enable_nonlocking_formatter_optimization<U>;
(since C++23)

This specialization of std::enable_nonlocking_formatter_optimization enables efficient implementation of std::print and std::println for printing a pair object when both T and U enable it.

[edit] Deduction guides(since C++17) [edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior LWG 2796 C++98 triviality of the destructor of pair was unspecified specified [edit] See also implements fixed size container, which holds elements of possibly different types
(class template) [edit] creates a tuple of lvalue references or unpacks a tuple into individual objects
(function template) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4