]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Sequences/Views//empty_sequence |
2 | ||
3 | empty_sequence | |
4 | ============== | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | struct empty_sequence | |
12 | { | |
13 | // |unspecified| | |
14 | // |...| | |
15 | }; | |
16 | ||
17 | ||
18 | Description | |
19 | ----------- | |
20 | ||
21 | Represents a sequence containing no elements. | |
22 | ||
23 | ||
24 | Header | |
25 | ------ | |
26 | ||
27 | .. parsed-literal:: | |
28 | ||
29 | #include <boost/mpl/empty_sequence.hpp> | |
30 | ||
31 | ||
32 | Expression semantics | |
33 | -------------------- | |
34 | ||
35 | |Semantics disclaimer...| |Random Access Sequence|. | |
36 | ||
37 | In the following table, ``s`` is an instance of ``empty_sequence``. | |
38 | ||
39 | +-------------------------------+-----------------------------------------------------------+ | |
40 | | Expression | Semantics | | |
41 | +===============================+===========================================================+ | |
42 | | ``empty_sequence`` | An empty |Random Access Sequence|. | | |
43 | +-------------------------------+-----------------------------------------------------------+ | |
44 | | ``size<s>::type`` | ``size<s>::value == 0``; see |Random Access Sequence|. | | |
45 | +-------------------------------+-----------------------------------------------------------+ | |
46 | ||
47 | ||
48 | Example | |
49 | ------- | |
50 | ||
51 | .. parsed-literal:: | |
52 | ||
53 | typedef begin<empty_sequence>::type first; | |
54 | typedef end<empty_sequence>::type last; | |
55 | ||
56 | BOOST_MPL_ASSERT(( is_same<first,last> )); | |
57 | BOOST_MPL_ASSERT_RELATION( size<empty_sequence>::value, ==, 0 ); | |
58 | ||
59 | typedef transform_view< | |
60 | empty_sequence | |
61 | , add_pointer<_> | |
62 | > empty_view; | |
63 | ||
64 | BOOST_MPL_ASSERT_RELATION( size<empty_sequence>::value, ==, 0 ); | |
65 | ||
66 | ||
67 | See also | |
68 | -------- | |
69 | ||
70 | |Sequences|, |Views|, |vector|, |list|, |single_view| | |
71 | ||
72 | ||
73 |