• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Data Types/Miscellaneous//pair |10
2
3pair
4====
5
6Synopsis
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
23Description
24-----------
25
26A transparent holder for two arbitrary types.
27
28
29Header
30------
31
32.. parsed-literal::
33
34    #include <boost/mpl/pair.hpp>
35
36
37Example
38-------
39
40Count a number of elements in the sequence together with a number of negative
41elements 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
62See 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)
71