GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::pair(3) C++ Standard Libary std::pair(3)

std::pair - std::pair


Defined in header <utility>
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.


T1, T2 - the types of the elements that the pair stores.


Member type Definition
first_type T1
second_type T2


Member name Type
first T1
second T2


constructor constructs new pair
(public member function)
operator= assigns the contents
(public member function)
swap swaps the contents
(C++11) (public member function)


make_pair creates a pair object of type, defined by the argument types
(function template)
operator==
operator!=
operator<
operator<=
operator>
operator>= lexicographically compares the values in the pair
operator<=> (function template)
(removed in C++20)
(removed in C++20)
(removed in C++20)
(removed in C++20)
(removed in C++20)
(C++20)
std::swap(std::pair) specializes the std::swap algorithm
(C++11) (function template)
std::get(std::pair) accesses an element of a pair
(C++11) (function template)


std::tuple_size<std::pair> obtains the size of a pair
(C++11) (class template specialization)
std::tuple_element<std::pair> obtains the type of the elements of pair
(C++11) (class template specialization)
std::basic_common_reference<std::pair> determines the common reference type of two
(C++23) pairs
(class template specialization)
std::common_type<std::pair> determines the common type of two pairs
(C++23) (class template specialization)


Deduction guides(since C++17)


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 specified
unspecified


tuple implements fixed size container, which holds elements of possibly different
(C++11) types
(class template)
tie creates a tuple of lvalue references or unpacks a tuple into individual
(C++11) objects
(function template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.