]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Sequences/Concepts//Integral Sequence Wrapper |90 |
2 | ||
3 | Integral Sequence Wrapper | |
4 | ========================= | |
5 | ||
6 | Description | |
7 | ----------- | |
8 | ||
9 | An |Integral Sequence Wrapper| is a class template that provides a concise | |
10 | interface for creating a corresponding sequence of |Integral Constant|\ s. In | |
11 | particular, assuming that ``seq`` is a name of the wrapper's underlying | |
12 | sequence and |c1...cn| are integral constants of an integral type ``T`` to | |
13 | be stored in the sequence, the wrapper provides us with the following | |
14 | notation: | |
15 | ||
16 | .. line-block:: | |
17 | ||
18 | ``seq_c<T``,\ |c1...cn|\ ``>`` | |
19 | ||
20 | If ``seq`` is a |Variadic Sequence|, *numbered* wrapper forms are | |
21 | also avaialable: | |
22 | ||
23 | .. line-block:: | |
24 | ||
25 | ``seq``\ *n*\ ``_c<T``,\ |c1...cn|\ ``>`` | |
26 | ||
27 | ||
28 | ||
29 | Expression requirements | |
30 | ----------------------- | |
31 | ||
32 | |In the following table...| ``seq`` is a placeholder token for the | |
33 | |Integral Sequence Wrapper|'s underlying sequence's name. | |
34 | ||
35 | ||
36 | .. |seq_c| replace:: ``seq_c<T``,\ |c1...cn| | |
37 | .. |seqn_c| replace:: ``seq``\ *n*\ ``_c<T``,\ |c1...cn| | |
38 | ||
39 | ||
40 | +-------------------------------+-----------------------+---------------------------+ | |
41 | | Expression | Type | Complexity | | |
42 | +===============================+=======================+===========================+ | |
43 | | |seq_c|\ ``>`` | |Forward Sequence| | Amortized constant time. | | |
44 | +-------------------------------+-----------------------+---------------------------+ | |
45 | | |seq_c|\ ``>::type`` | |Forward Sequence| | Amortized constant time. | | |
46 | +-------------------------------+-----------------------+---------------------------+ | |
47 | | |seq_c|\ ``>::value_type`` | An integral type | Amortized constant time. | | |
48 | +-------------------------------+-----------------------+---------------------------+ | |
49 | | |seqn_c|\ ``>`` | |Forward Sequence| | Amortized constant time. | | |
50 | +-------------------------------+-----------------------+---------------------------+ | |
51 | | |seqn_c|\ ``>::type`` | |Forward Sequence| | Amortized constant time. | | |
52 | +-------------------------------+-----------------------+---------------------------+ | |
53 | | |seqn_c|\ ``>::value_type`` | An integral type | Amortized constant time. | | |
54 | +-------------------------------+-----------------------+---------------------------+ | |
55 | ||
56 | ||
57 | Expression semantics | |
58 | -------------------- | |
59 | ||
60 | ||
61 | .. parsed-literal:: | |
62 | ||
63 | typedef seq_c<T,\ |c1...cn|> s; | |
64 | typedef seq\ *n*\ _c<T,\ |c1...cn|> s; | |
65 | ||
66 | :Semantics: | |
67 | ``s`` is a sequence ``seq`` of integral constant wrappers ``integral_c<T,``\ |c1|\ ``>``, | |
68 | ``integral_c<T,``\ |c2|\ ``>``, ... ``integral_c<T,``\ |cn|\ ``>``. | |
69 | ||
70 | :Postcondition: | |
71 | ``size<s>::value == n``. | |
72 | ||
73 | .. .. parsed-literal:: | |
74 | ||
75 | BOOST_MPL_ASSERT_RELATION(( at_c<v,0>::type::value,==,\ |c1| )); | |
76 | BOOST_MPL_ASSERT_RELATION(( at_c<v,1>::type::value,==,\ |c2| )); | |
77 | ... | |
78 | BOOST_MPL_ASSERT_RELATION(( at_c<v,\ *n*>::type::value,==,\ |cn| )); | |
79 | ||
80 | ||
81 | .. .......................................................................... | |
82 | ||
83 | .. parsed-literal:: | |
84 | ||
85 | typedef seq_c<T,\ |c1...cn|>::type s; | |
86 | typedef seq\ *n*\ _c<T,\ |c1...cn|>::type s; | |
87 | ||
88 | :Semantics: | |
89 | ``s`` is identical to | |
90 | ``seq``\ *n*\ ``<``\ ``integral_c<T,``\ |c1|\ ``>``,\ ``integral_c<T,``\ |c2|\ ``>``, | |
91 | ... ``integral_c<T,``\ |cn|\ ``>`` ``>``. | |
92 | ||
93 | ||
94 | .. .......................................................................... | |
95 | ||
96 | .. parsed-literal:: | |
97 | ||
98 | typedef seq_c<T,\ |c1...cn|>::value_type t; | |
99 | typedef seq\ *n*\ _c<T,\ |c1...cn|>::value_type t; | |
100 | ||
101 | :Semantics: | |
102 | ``is_same<t,T>::value == true``. | |
103 | ||
104 | ||
105 | Models | |
106 | ------ | |
107 | ||
108 | * |vector_c| | |
109 | * |list_c| | |
110 | * |set_c| | |
111 | ||
112 | See also | |
113 | -------- | |
114 | ||
115 | |Sequences|, |Variadic Sequence|, |Integral Constant| | |
116 | ||
117 | ||
118 |