]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <?xml version="1.0" encoding="utf-8" ?> |
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
4 | <head> | |
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
6 | <meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" /> | |
7 | <title>The MPL Reference Manual: range_c</title> | |
8 | <link rel="stylesheet" href="../style.css" type="text/css" /> | |
9 | </head> | |
10 | <body class="docframe refmanual"> | |
11 | <table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./map.html" class="navigation-link">Prev</a> <a href="./vector-c.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./map.html" class="navigation-link">Back</a> <a href="./vector-c.html" class="navigation-link">Along</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./classes.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td> | |
12 | <td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./sequences.html" class="navigation-link">Sequences</a> / <a href="./classes.html" class="navigation-link">Classes</a> / <a href="./range-c.html" class="navigation-link">range_c</a></td> | |
13 | </tr></table><div class="header-separator"></div> | |
14 | <div class="section" id="range-c"> | |
15 | <h1><a class="toc-backref" href="./classes.html#id1411">range_c</a></h1> | |
16 | <div class="section" id="synopsis"> | |
17 | <h3>Synopsis</h3> | |
18 | <pre class="literal-block"> | |
19 | template< | |
20 | typename T | |
21 | , T Start | |
22 | , T Finish | |
23 | > | |
24 | struct <a href="./range-c.html" class="identifier">range_c</a> | |
25 | { | |
26 | typedef <a href="./integral-c.html" class="identifier">integral_c</a><T,Start> start; | |
27 | typedef <a href="./integral-c.html" class="identifier">integral_c</a><T,Finish> finish; | |
28 | // <em>unspecified</em> | |
29 | // <em>...</em> | |
30 | }; | |
31 | </pre> | |
32 | </div> | |
33 | <div class="section" id="id88"> | |
34 | <h3><a class="subsection-title" href="#description" name="description">Description</a></h3> | |
35 | <p><tt class="literal"><span class="pre"><a href="./range-c.html" class="identifier">range_c</a></span></tt> is a sorted <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a> of <a class="reference internal" href="./integral-constant.html">Integral Constant</a>s. Note | |
36 | that because it is not an <a class="reference internal" href="./extensible-sequence.html">Extensible Sequence</a>, sequence-building | |
37 | intrinsic metafunctions such as <tt class="literal"><span class="pre"><a href="./push-front.html" class="identifier">push_front</a></span></tt> and transformation algorithms | |
38 | such as <tt class="literal"><span class="pre"><a href="./replace.html" class="identifier">replace</a></span></tt> are not directly applicable — to be able to use | |
39 | them, you'd first need to copy the content of the range into a more suitable | |
40 | sequence.</p> | |
41 | </div> | |
42 | <div class="section" id="id89"> | |
43 | <h3><a class="subsection-title" href="#header" name="header">Header</a></h3> | |
44 | <pre class="literal-block"> | |
45 | #include <<a href="../../../../boost/mpl/range_c.hpp" class="header">boost/mpl/range_c.hpp</a>> | |
46 | </pre> | |
47 | </div> | |
48 | <div class="section" id="id90"> | |
49 | <h3><a class="subsection-title" href="#model-of" name="model-of">Model of</a></h3> | |
50 | <p><a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a></p> | |
51 | </div> | |
52 | <div class="section" id="id91"> | |
53 | <h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3> | |
54 | <p>In the following table, <tt class="literal"><span class="pre">r</span></tt> is an instance of <tt class="literal"><span class="pre"><a href="./range-c.html" class="identifier">range_c</a></span></tt>, <tt class="literal"><span class="pre">n</span></tt> is an <a class="reference internal" href="./integral-constant.html">Integral Constant</a>, | |
55 | <tt class="literal"><span class="pre">T</span></tt> is an arbitrary integral type, and <tt class="literal"><span class="pre">n</span></tt> and <tt class="literal"><span class="pre">m</span></tt> are integral constant values of type <tt class="literal"><span class="pre">T</span></tt>.</p> | |
56 | <table border="1" class="docutils table"> | |
57 | <colgroup> | |
58 | <col width="34%" /> | |
59 | <col width="66%" /> | |
60 | </colgroup> | |
61 | <thead valign="bottom"> | |
62 | <tr><th class="head">Expression</th> | |
63 | <th class="head">Semantics</th> | |
64 | </tr> | |
65 | </thead> | |
66 | <tbody valign="top"> | |
67 | <tr><td><pre class="first last literal-block"> | |
68 | <tt class="literal"><span class="pre"><a href="./range-c.html" class="identifier">range_c</a><T,n,m></span></tt> | |
69 | <tt class="literal"><span class="pre"><a href="./range-c.html" class="identifier">range_c</a><T,n,m>::type</span></tt> | |
70 | </pre> | |
71 | </td> | |
72 | <td>A sorted <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a> of integral constant | |
73 | wrappers for the half-open range of values [<tt class="literal"><span class="pre">n</span></tt>, | |
74 | <tt class="literal"><span class="pre">m</span></tt>): <tt class="literal"><span class="pre"><a href="./integral-c.html" class="identifier">integral_c</a><T,n></span></tt>, <tt class="literal"><span class="pre"><a href="./integral-c.html" class="identifier">integral_c</a><T,n+1></span></tt>,... | |
75 | <tt class="literal"><span class="pre"><a href="./integral-c.html" class="identifier">integral_c</a><T,m-1></span></tt>.</td> | |
76 | </tr> | |
77 | <tr><td><tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a><r>::type</span></tt></td> | |
78 | <td>An iterator pointing to the beginning of <tt class="literal"><span class="pre">r</span></tt>; | |
79 | see <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a>.</td> | |
80 | </tr> | |
81 | <tr><td><tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a><r>::type</span></tt></td> | |
82 | <td>An iterator pointing to the end of <tt class="literal"><span class="pre">r</span></tt>; | |
83 | see <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a>.</td> | |
84 | </tr> | |
85 | <tr><td><tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a><r>::type</span></tt></td> | |
86 | <td>The size of <tt class="literal"><span class="pre">r</span></tt>; see <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a>.</td> | |
87 | </tr> | |
88 | <tr><td><tt class="literal"><span class="pre"><a href="./empty.html" class="identifier">empty</a><r>::type</span></tt></td> | |
89 | <td>A boolean <a class="reference internal" href="./integral-constant.html">Integral Constant</a> <tt class="literal"><span class="pre">c</span></tt> such that | |
90 | <tt class="literal"><span class="pre">c::value</span> <span class="pre">==</span> <span class="pre">true</span></tt> if and only if <tt class="literal"><span class="pre">r</span></tt> is empty; see | |
91 | <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a>.</td> | |
92 | </tr> | |
93 | <tr><td><tt class="literal"><span class="pre"><a href="./front.html" class="identifier">front</a><r>::type</span></tt></td> | |
94 | <td>The first element in <tt class="literal"><span class="pre">r</span></tt>; see | |
95 | <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a>.</td> | |
96 | </tr> | |
97 | <tr><td><tt class="literal"><span class="pre"><a href="./back.html" class="identifier">back</a><r>::type</span></tt></td> | |
98 | <td>The last element in <tt class="literal"><span class="pre">r</span></tt>; see | |
99 | <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a>.</td> | |
100 | </tr> | |
101 | <tr><td><tt class="literal"><span class="pre"><a href="./at.html" class="identifier">at</a><r,n>::type</span></tt></td> | |
102 | <td>The <tt class="literal"><span class="pre">n</span></tt>th element from the beginning of <tt class="literal"><span class="pre">r</span></tt>; see | |
103 | <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a>.</td> | |
104 | </tr> | |
105 | </tbody> | |
106 | </table> | |
107 | </div> | |
108 | <div class="section" id="id92"> | |
109 | <h3><a class="subsection-title" href="#example" name="example">Example</a></h3> | |
110 | <pre class="literal-block"> | |
111 | typedef <a href="./range-c.html" class="identifier">range_c</a><int,0,0> range0; | |
112 | typedef <a href="./range-c.html" class="identifier">range_c</a><int,0,1> range1; | |
113 | typedef <a href="./range-c.html" class="identifier">range_c</a><int,0,10> range10; | |
114 | ||
115 | <a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( <a href="./size.html" class="identifier">size</a><range0>::value, ==, 0 ); | |
116 | <a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( <a href="./size.html" class="identifier">size</a><range1>::value, ==, 1 ); | |
117 | <a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( <a href="./size.html" class="identifier">size</a><range10>::value, ==, 10 ); | |
118 | ||
119 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( <a href="./empty.html" class="identifier">empty</a><range0> )); | |
120 | <a href="./assert-not.html" class="identifier">BOOST_MPL_ASSERT_NOT</a>(( <a href="./empty.html" class="identifier">empty</a><range1> )); | |
121 | <a href="./assert-not.html" class="identifier">BOOST_MPL_ASSERT_NOT</a>(( <a href="./empty.html" class="identifier">empty</a><range10> )); | |
122 | ||
123 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< <a href="./begin.html" class="identifier">begin</a><range0>::type, <a href="./end.html" class="identifier">end</a><range0>::type > )); | |
124 | <a href="./assert-not.html" class="identifier">BOOST_MPL_ASSERT_NOT</a>(( is_same< <a href="./begin.html" class="identifier">begin</a><range1>::type, <a href="./end.html" class="identifier">end</a><range1>::type > )); | |
125 | <a href="./assert-not.html" class="identifier">BOOST_MPL_ASSERT_NOT</a>(( is_same< <a href="./begin.html" class="identifier">begin</a><range10>::type, <a href="./end.html" class="identifier">end</a><range10>::type > )); | |
126 | ||
127 | <a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( <a href="./front.html" class="identifier">front</a><range1>::type::value, ==, 0 ); | |
128 | <a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( <a href="./back.html" class="identifier">back</a><range1>::type::value, ==, 0 ); | |
129 | <a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( <a href="./front.html" class="identifier">front</a><range10>::type::value, ==, 0 ); | |
130 | <a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( <a href="./back.html" class="identifier">back</a><range10>::type::value, ==, 9 ); | |
131 | </pre> | |
132 | </div> | |
133 | <div class="section" id="id93"> | |
134 | <h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3> | |
135 | <p><a class="reference internal" href="./sequences.html">Sequences</a>, <a class="reference internal" href="./random-access-sequence.html">Random Access Sequence</a>, <a class="reference internal" href="./vector-c.html">vector_c</a>, <a class="reference internal" href="./set-c.html">set_c</a>, <a class="reference internal" href="./list-c.html">list_c</a></p> | |
136 | <!-- Sequences/Classes//vector_c |70 --> | |
137 | </div> | |
138 | </div> | |
139 | ||
140 | <div class="footer-separator"></div> | |
141 | <table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./map.html" class="navigation-link">Prev</a> <a href="./vector-c.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./map.html" class="navigation-link">Back</a> <a href="./vector-c.html" class="navigation-link">Along</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./classes.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td> | |
142 | <td><div class="copyright-footer"><div class="copyright">Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams</div> | |
143 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
144 | file LICENSE_1_0.txt or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</div></td></tr></table></body> | |
145 | </html> |