Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/utility/pair"

From cppreference.com
< cpp‎ | utility
m (Text replace - "{{tdcl" to "{{dcl")
m (Text replace - "/sidebar" to "/navbar")
Line 1: Line 1:
 
{{cpp/title|pair}}
 
{{cpp/title|pair}}
{{cpp/utility/pair/sidebar}}
+
{{cpp/utility/pair/navbar}}
 
{{ddcl | header=utility |
 
{{ddcl | header=utility |
 
template<
 
template<

Revision as of 14:17, 15 June 2012

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
 
Defined in header <utility>
template<

    class T1,
    class T2

> struct pair;

std::pair is a struct template that provides a way to store two heterogeneous objects as a single unit.

Contents

Member types

Member type Definition
first_type T1
second_type T2

Member objects

Member name Type
first T1
second T2

Member functions

constructs new pair
(public member function)
assigns the contents
(public member function)
(C++11)
swaps the contents
(public member function)

Non-member functions

creates a pair object of type, determined by the argument types
(function template) [edit]
(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(C++20)
lexicographically compares the values in the pair
(function template) [edit]
specializes the std::swap algorithm
(function template) [edit]
accesses an element of a pair
(function template) [edit]

Helper classes

obtains the size of a pair
(class template specialization) [edit]
obtains the type of the elements of pair
(class template specialization) [edit]