Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/utility/pair"

From cppreference.com
< cpp‎ | utility
(piecewise belongs here, also tuple-like metafunctions are defined for pairs as well.)
m (er, get is a function)
Line 36: Line 36:
 
{{dcl list template | cpp/utility/pair/dcl list operator_comp}}
 
{{dcl list template | cpp/utility/pair/dcl list operator_comp}}
 
{{dcl list template | cpp/utility/pair/dcl list std_swap}}
 
{{dcl list template | cpp/utility/pair/dcl list std_swap}}
 +
{{dcl list tfun | cpp/utility/tuple/get | accesses an element of a {{rlt|pair}} similar to {{rlt|tuple}} | notes={{mark c++11}}}}
 
{{dcl list end}}
 
{{dcl list end}}
 
===Helper classes===
 
===Helper classes===
 
{{dcl list begin}}
 
{{dcl list begin}}
{{dcl list tfun | cpp/utility/tuple/get | accesses an element of a {{rlt|pair}} similar to {{rlt|tuple}} | notes={{mark c++11}}}}
 
 
{{dcl list tclass | cpp/utility/tuple/tuple_size | obtains the size of a {{rlt|pair}} similar to {{rlt|tuple}} | notes={{mark c++11}}}}
 
{{dcl list tclass | cpp/utility/tuple/tuple_size | obtains the size of a {{rlt|pair}} similar to {{rlt|tuple}} | notes={{mark c++11}}}}
 
{{dcl list tclass | cpp/utility/tuple/tuple_element | obtains the type of the elements of {{rlt|pair}} similar to {{rlt|tuple}} | notes={{mark c++11}}}}
 
{{dcl list tclass | cpp/utility/tuple/tuple_element | obtains the type of the elements of {{rlt|pair}} similar to {{rlt|tuple}} | notes={{mark c++11}}}}
 
{{dcl list class | cpp/utility/tuple/piecewise_construct_t | disambiguates constructor and function overloading for piecewise construction | notes={{mark c++11}}}}
 
{{dcl list class | cpp/utility/tuple/piecewise_construct_t | disambiguates constructor and function overloading for piecewise construction | notes={{mark c++11}}}}
 
{{dcl list end}}
 
{{dcl list end}}

Revision as of 19:59, 22 August 2011

Template:cpp/utility/pair/sidebar

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 functions

Template:dcl list mem cons
assigns the contents
(public member function)
swaps the contents
(public member function)

Member types

Template:tdcl list begin Template:tdcl list hitem Template:tdcl list item Template:tdcl list item Template:tdcl list end

Template:tdcl list begin Template:tdcl list h1 Template:tdcl list hitem Template:tdcl list item Template:tdcl list item Template:tdcl list end

Non-member functions

Template:cpp/utility/pair/dcl list operator compTemplate:cpp/utility/pair/dcl list std swap
creates a pair object of type, defined by the argument types
(function template)
(C++11)
accesses an element of a pair similar to tuple
(function template)

Helper classes

obtains the size of a pair similar to tuple
(class template)
obtains the type of the elements of pair similar to tuple
(class template)
disambiguates constructor and function overloading for piecewise construction
(class)