Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Pairs

Description

The TR1 Tuple interface is specified to provide uniform access to std::pair as if it were a 2 element tuple.

Specification
tuple_size<std::pair<T1, T2> >::value

Type: An MPL Integral Constant

Value: Returns 2, the number of elements in a pair.

tuple_element<0, std::pair<T1, T2> >::type

Type: T1

Value: Returns the type of the first element of the pair

tuple_element<1, std::pair<T1, T2> >::type

Type: T2

Value: Returns thetype of the second element of the pair

template<int I, typename T1, typename T2>
P& get(std::pair<T1, T2>& pr);

template<int I, typename T1, typename T2>
const P& get(const std::pair<T1, T2>& pr);

Type: If I == 0 P is T1, else if I == 1 P is T2 else the program is ill-formed.

Returns: pr.first if I == 0 else pr.second.[*Returns: pr.first if I == 0 else pr.second.


PrevUpHomeNext