![]() |
Home | Libraries | People | FAQ | More |
Fusion pair
type is a half
runtime pair. A half runtime pair is similar to a std::pair
,
but, unlike std::pair
,
the first type does not have data. It is used as elements in _map_s,
for example.
template <typename First, typename Second> struct pair; namespace result_of { template <typename First, typename Second> struct first; template <typename First, typename Second> struct second; template <typename First, typename Second> struct make_pair; } template <typename First, typename Second> typename result_of::make_pair<First,Second>::type make_pair(Second const &);
Parameter | Description |
---|---|
First | The first type. This is purely a type. No data is held. |
Second | The second type. This contains data. |
Notation
P
p
,
p2
F
,
S
s
S
o
i
Expression | Semantics |
---|---|
P::first_type |
The type
of the first template parameter, F ,
equivalent to result_of::first<P>::type .
|
P::second_type |
The type
of the second template parameter, S ,
equivalent to result_of::second<P>::type .
|
P() |
Default construction. |
P(s) |
Construct
a pair given value for the second type, s . |
P(p2) |
Copy
constructs a pair from another pair, p2 . |
p =
p2 |
Assigns
a pair, p1, from another pair, p2 . |
make_pair<F>(s) | Make a pair given the first
type, F , and a value
for the second type, s .
The second type assumes the type of s
|
o <<
p |
Output p to output stream, o . |
i >>
p |
Input p from input stream, i . |
p ==
p2 |
Tests two pairs for equality. |
p !=
p2 |
Tests two pairs for inequality. |
#include <boost/fusion/support/pair.hpp>
pair<int, char> p('X'); std::cout << p << std::endl; std::cout << make_pair<int>('X') << std::endl; assert((p == make_pair<int>('X')));
Copyright © 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger |