]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Data Types/Numeric//size_t |40 |
2 | ||
3 | size_t | |
4 | ====== | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | template< | |
12 | std::size_t N | |
13 | > | |
14 | struct size_t | |
15 | { | |
16 | // |unspecified| | |
17 | // ... | |
18 | }; | |
19 | ||
20 | ||
21 | Description | |
22 | ----------- | |
23 | ||
24 | An |Integral Constant| wrapper for ``std::size_t``. | |
25 | ||
26 | ||
27 | Header | |
28 | ------ | |
29 | ||
30 | .. parsed-literal:: | |
31 | ||
32 | #include <boost/mpl/size_t.hpp> | |
33 | ||
34 | ||
35 | Model of | |
36 | -------- | |
37 | ||
38 | |Integral Constant| | |
39 | ||
40 | ||
41 | Parameters | |
42 | ---------- | |
43 | ||
44 | +---------------+-------------------------------+---------------------------+ | |
45 | | Parameter | Requirement | Description | | |
46 | +===============+===============================+===========================+ | |
47 | | ``N`` | An integral constant | A value to wrap. | | |
48 | +---------------+-------------------------------+---------------------------+ | |
49 | ||
50 | Expression semantics | |
51 | -------------------- | |
52 | ||
53 | |Semantics disclaimer...| |Integral Constant|. | |
54 | ||
55 | For arbitrary integral constant ``n``: | |
56 | ||
57 | +-------------------+-----------------------------------------------------------+ | |
58 | | Expression | Semantics | | |
59 | +===================+===========================================================+ | |
60 | | ``size_t<c>`` | An |Integral Constant| ``x`` such that ``x::value == c`` | | |
61 | | | and ``x::value_type`` is identical to ``std::size_t``. | | |
62 | +-------------------+-----------------------------------------------------------+ | |
63 | ||
64 | ||
65 | Example | |
66 | ------- | |
67 | ||
68 | .. parsed-literal:: | |
69 | ||
70 | typedef size_t<8> eight; | |
71 | ||
72 | BOOST_MPL_ASSERT(( is_same< eight::value_type, std::size_t > )); | |
73 | BOOST_MPL_ASSERT(( is_same< eight::type, eight > )); | |
74 | BOOST_MPL_ASSERT(( is_same< next< eight >::type, size_t<9> > )); | |
75 | BOOST_MPL_ASSERT(( is_same< prior< eight >::type, size_t<7> > )); | |
76 | BOOST_MPL_ASSERT_RELATION( (eight::value), ==, 8 ); | |
77 | assert( eight() == 8 ); | |
78 | ||
79 | ||
80 | See also | |
81 | -------- | |
82 | ||
83 | |Data Types|, |Integral Constant|, |int_|, |long_|, |integral_c| | |
84 | ||
85 | ||
86 |