]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/doc/src/refmanual/pair.rst
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / pair.rst
1 .. Data Types/Miscellaneous//pair |10
2
3 pair
4 ====
5
6 Synopsis
7 --------
8
9 .. parsed-literal::
10
11 template<
12 typename T1
13 , typename T2
14 >
15 struct pair
16 {
17 typedef pair type;
18 typedef T1 first;
19 typedef T2 second;
20 };
21
22
23 Description
24 -----------
25
26 A transparent holder for two arbitrary types.
27
28
29 Header
30 ------
31
32 .. parsed-literal::
33
34 #include <boost/mpl/pair.hpp>
35
36
37 Example
38 -------
39
40 Count a number of elements in the sequence together with a number of negative
41 elements among these.
42
43 .. parsed-literal::
44
45 typedef fold<
46 vector_c<int,-1,0,5,-7,-2,4,5,7>
47 , pair< int_<0>, int_<0> >
48 , pair<
49 next< first<_1> >
50 , if_<
51 less< _2, int_<0> >
52 , next< second<_1> >
53 , second<_1>
54 >
55 >
56 >::type p;
57
58 BOOST_MPL_ASSERT_RELATION( p::first::value, ==, 8 );
59 BOOST_MPL_ASSERT_RELATION( p::second::value, ==, 3 );
60
61
62 See also
63 --------
64
65 |Data Types|, |Sequences|, |first|, |second|
66
67
68 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
69 Distributed under the Boost Software License, Version 1.0. (See accompanying
70 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)