• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Signed Integer Parsers (int_, etc.)</title>
5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../../index.html" title="Spirit 2.5.8">
8<link rel="up" href="../numeric.html" title="Numeric Parsers">
9<link rel="prev" href="uint.html" title="Unsigned Integer Parsers (uint_, etc.)">
10<link rel="next" href="real.html" title="Real Number Parsers (float_, double_, etc.)">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="uint.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../numeric.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="real.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h5 class="title">
27<a name="spirit.qi.reference.numeric.int"></a><a class="link" href="int.html" title="Signed Integer Parsers (int_, etc.)">Signed Integer Parsers
28          (<code class="computeroutput"><span class="identifier">int_</span></code>, etc.)</a>
29</h5></div></div></div>
30<h6>
31<a name="spirit.qi.reference.numeric.int.h0"></a>
32            <span class="phrase"><a name="spirit.qi.reference.numeric.int.description"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.description">Description</a>
33          </h6>
34<p>
35            The <code class="computeroutput"><span class="identifier">int_parser</span></code> can parse
36            signed integers of arbitrary length and size. This is almost the same
37            as the <code class="computeroutput"><span class="identifier">uint_parser</span></code>. The
38            only difference is the additional task of parsing the <code class="computeroutput"><span class="char">'+'</span></code>
39            or <code class="computeroutput"><span class="char">'-'</span></code> sign preceding the number.
40            The class interface is the same as that of the <code class="computeroutput"><span class="identifier">uint_parser</span></code>.
41          </p>
42<p>
43            The <code class="computeroutput"><span class="identifier">int_parser</span></code> parser
44            can be used to parse ordinary primitive C/C++ integers or even user defined
45            scalars such as bigints (unlimited precision integers) as long as the
46            type follows certain expression requirements (documented below).
47          </p>
48<h6>
49<a name="spirit.qi.reference.numeric.int.h1"></a>
50            <span class="phrase"><a name="spirit.qi.reference.numeric.int.header"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.header">Header</a>
51          </h6>
52<pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/home/qi/numeric/int.hpp&gt;</span>
53<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
54</pre>
55<p>
56            Also, see <a class="link" href="../../../structure/include.html" title="Include">Include Structure</a>.
57          </p>
58<h6>
59<a name="spirit.qi.reference.numeric.int.h2"></a>
60            <span class="phrase"><a name="spirit.qi.reference.numeric.int.namespace"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.namespace">Namespace</a>
61          </h6>
62<div class="informaltable"><table class="table">
63<colgroup><col></colgroup>
64<thead><tr><th>
65                    <p>
66                      Name
67                    </p>
68                  </th></tr></thead>
69<tbody>
70<tr><td>
71                    <p>
72                      <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lit</span> <span class="comment">// alias:
73                      boost::spirit::qi::lit</span></code>
74                    </p>
75                  </td></tr>
76<tr><td>
77                    <p>
78                      <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">short_</span> <span class="comment">//
79                      alias: boost::spirit::qi::short_</span></code>
80                    </p>
81                  </td></tr>
82<tr><td>
83                    <p>
84                      <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">int_</span> <span class="comment">// alias:
85                      boost::spirit::qi::int_</span></code>
86                    </p>
87                  </td></tr>
88<tr><td>
89                    <p>
90                      <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">long_</span> <span class="comment">//
91                      alias: boost::spirit::qi::long_</span></code>
92                    </p>
93                  </td></tr>
94<tr><td>
95                    <p>
96                      <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">long_long</span> <span class="comment">//
97                      alias: boost::spirit::qi::long_long</span></code>
98                    </p>
99                  </td></tr>
100</tbody>
101</table></div>
102<div class="note"><table border="0" summary="Note">
103<tr>
104<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../images/note.png"></td>
105<th align="left">Note</th>
106</tr>
107<tr><td align="left" valign="top"><p>
108              <code class="computeroutput"><span class="identifier">long_long</span></code> is only available
109              on platforms where the preprocessor constant <code class="computeroutput"><span class="identifier">BOOST_HAS_LONG_LONG</span></code>
110              is defined (i.e. on platforms having native support for <code class="computeroutput"><span class="keyword">signed</span> <span class="keyword">long</span>
111              <span class="keyword">long</span></code> (64 bit) unsigned integer
112              types).
113            </p></td></tr>
114</table></div>
115<div class="note"><table border="0" summary="Note">
116<tr>
117<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../images/note.png"></td>
118<th align="left">Note</th>
119</tr>
120<tr><td align="left" valign="top"><p>
121              <code class="computeroutput"><span class="identifier">lit</span></code> is reused by the
122              <a class="link" href="../char/char.html" title="Character Parser (char_, lit)">Character Parsers</a>,
123              and the Numeric Parsers. In general, a char parser is created when
124              you pass in a character, and a numeric parser is created when you use
125              a numeric literal.
126            </p></td></tr>
127</table></div>
128<h6>
129<a name="spirit.qi.reference.numeric.int.h3"></a>
130            <span class="phrase"><a name="spirit.qi.reference.numeric.int.synopsis"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.synopsis">Synopsis</a>
131          </h6>
132<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span>
133    <span class="keyword">typename</span> <span class="identifier">T</span>
134  <span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">Radix</span>
135  <span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">MinDigits</span>
136  <span class="special">,</span> <span class="keyword">int</span> <span class="identifier">MaxDigits</span><span class="special">&gt;</span>
137<span class="keyword">struct</span> <span class="identifier">int_parser</span><span class="special">;</span>
138</pre>
139<h6>
140<a name="spirit.qi.reference.numeric.int.h4"></a>
141            <span class="phrase"><a name="spirit.qi.reference.numeric.int.template_parameters"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.template_parameters">Template
142            parameters</a>
143          </h6>
144<div class="informaltable"><table class="table">
145<colgroup>
146<col>
147<col>
148<col>
149</colgroup>
150<thead><tr>
151<th>
152                    <p>
153                      Parameter
154                    </p>
155                  </th>
156<th>
157                    <p>
158                      Description
159                    </p>
160                  </th>
161<th>
162                    <p>
163                      Default
164                    </p>
165                  </th>
166</tr></thead>
167<tbody>
168<tr>
169<td>
170                    <p>
171                      <code class="computeroutput"><span class="identifier">T</span></code>
172                    </p>
173                  </td>
174<td>
175                    <p>
176                      The numeric base type of the numeric parser.
177                    </p>
178                  </td>
179<td>
180                    <p>
181                      none
182                    </p>
183                  </td>
184</tr>
185<tr>
186<td>
187                    <p>
188                      <code class="computeroutput"><span class="identifier">Radix</span></code>
189                    </p>
190                  </td>
191<td>
192                    <p>
193                      The radix base. This can be any base from 2..10 and 16
194                    </p>
195                  </td>
196<td>
197                    <p>
198                      10
199                    </p>
200                  </td>
201</tr>
202<tr>
203<td>
204                    <p>
205                      <code class="computeroutput"><span class="identifier">MinDigits</span></code>
206                    </p>
207                  </td>
208<td>
209                    <p>
210                      The minimum number of digits allowable.
211                    </p>
212                  </td>
213<td>
214                    <p>
215                      1
216                    </p>
217                  </td>
218</tr>
219<tr>
220<td>
221                    <p>
222                      <code class="computeroutput"><span class="identifier">MaxDigits</span></code>
223                    </p>
224                  </td>
225<td>
226                    <p>
227                      The maximum number of digits allowable. If this is -1, then
228                      the maximum limit becomes unbounded.
229                    </p>
230                  </td>
231<td>
232                    <p>
233                      -1
234                    </p>
235                  </td>
236</tr>
237</tbody>
238</table></div>
239<h6>
240<a name="spirit.qi.reference.numeric.int.h5"></a>
241            <span class="phrase"><a name="spirit.qi.reference.numeric.int.model_of"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.model_of">Model
242            of</a>
243          </h6>
244<div class="blockquote"><blockquote class="blockquote"><p>
245              <a class="link" href="../parser_concepts/primitiveparser.html" title="PrimitiveParser"><code class="computeroutput"><span class="identifier">PrimitiveParser</span></code></a>
246            </p></blockquote></div>
247<div class="variablelist">
248<p class="title"><b>Notation</b></p>
249<dl class="variablelist">
250<dt><span class="term"><code class="computeroutput"><span class="identifier">n</span></code></span></dt>
251<dd><p>
252                  An object of <code class="computeroutput"><span class="identifier">T</span></code>,
253                  the numeric base type.
254                </p></dd>
255<dt><span class="term"><code class="computeroutput"><span class="identifier">num</span></code></span></dt>
256<dd><p>
257                  Numeric literal, any signed integer value, or a <a class="link" href="../basics.html#spirit.qi.reference.basics.lazy_argument">Lazy
258                  Argument</a> that evaluates to a signed integer value.
259                </p></dd>
260</dl>
261</div>
262<h6>
263<a name="spirit.qi.reference.numeric.int.h6"></a>
264            <span class="phrase"><a name="spirit.qi.reference.numeric.int.expression_semantics"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.expression_semantics">Expression
265            Semantics</a>
266          </h6>
267<p>
268            Semantics of an expression is defined only where it differs from, or
269            is not defined in <a class="link" href="../parser_concepts/primitiveparser.html" title="PrimitiveParser"><code class="computeroutput"><span class="identifier">PrimitiveParser</span></code></a>.
270          </p>
271<div class="informaltable"><table class="table">
272<colgroup>
273<col>
274<col>
275</colgroup>
276<thead><tr>
277<th>
278                    <p>
279                      Expression
280                    </p>
281                  </th>
282<th>
283                    <p>
284                      Semantics
285                    </p>
286                  </th>
287</tr></thead>
288<tbody>
289<tr>
290<td>
291                    <p>
292</p>
293<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">short_</span>
294<span class="identifier">int_</span>
295<span class="identifier">long_</span>
296<span class="identifier">long_long</span>
297</pre>
298<p>
299                    </p>
300                  </td>
301<td>
302                    <p>
303                      Parse a signed integer using the default radix (10).
304                    </p>
305                  </td>
306</tr>
307<tr>
308<td>
309                    <p>
310</p>
311<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">lit</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
312<span class="identifier">short_</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
313<span class="identifier">int_</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
314<span class="identifier">long_</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
315<span class="identifier">long_long</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
316</pre>
317<p>
318                    </p>
319                  </td>
320<td>
321                    <p>
322                      Match the literal <code class="computeroutput"><span class="identifier">num</span></code>
323                      using the default radix (10). The parser will fail if the parsed
324                      value is not equal to the specified value.
325                    </p>
326                  </td>
327</tr>
328<tr>
329<td>
330                    <p>
331</p>
332<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">int_parser</span><span class="special">&lt;</span>
333    <span class="identifier">T</span><span class="special">,</span> <span class="identifier">Radix</span><span class="special">,</span> <span class="identifier">MinDigits</span><span class="special">,</span> <span class="identifier">MaxDigits</span>
334<span class="special">&gt;()</span>
335</pre>
336<p>
337                    </p>
338                  </td>
339<td>
340                    <p>
341                      Parse a signed integer of type <code class="computeroutput"><span class="identifier">T</span></code>
342                      using radix <code class="computeroutput"><span class="identifier">Radix</span></code>,
343                      with a minimum of <code class="computeroutput"><span class="identifier">MinDigits</span></code>
344                      and a maximum of <code class="computeroutput"><span class="identifier">MaxDigits</span></code>.
345                    </p>
346                  </td>
347</tr>
348<tr>
349<td>
350                    <p>
351</p>
352<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">int_parser</span><span class="special">&lt;</span>
353    <span class="identifier">T</span><span class="special">,</span> <span class="identifier">Radix</span><span class="special">,</span> <span class="identifier">MinDigits</span><span class="special">,</span> <span class="identifier">MaxDigits</span>
354<span class="special">&gt;()(</span><span class="identifier">num</span><span class="special">)</span>
355</pre>
356<p>
357                    </p>
358                  </td>
359<td>
360                    <p>
361                      Match the literal <code class="computeroutput"><span class="identifier">num</span></code>
362                      of type <code class="computeroutput"><span class="identifier">T</span></code> using
363                      radix <code class="computeroutput"><span class="identifier">Radix</span></code>,
364                      with a minimum of <code class="computeroutput"><span class="identifier">MinDigits</span></code>
365                      and a maximum of <code class="computeroutput"><span class="identifier">MaxDigits</span></code>.
366                      The parser will fail if the parsed value is not equal to the
367                      specified value.
368                    </p>
369                  </td>
370</tr>
371</tbody>
372</table></div>
373<div class="important"><table border="0" summary="Important">
374<tr>
375<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../images/important.png"></td>
376<th align="left">Important</th>
377</tr>
378<tr><td align="left" valign="top"><p>
379              All numeric parsers check for overflow conditions based on the type
380              <code class="computeroutput"><span class="identifier">T</span></code> the corresponding
381              <code class="computeroutput"><span class="identifier">int_parser</span><span class="special">&lt;&gt;</span></code>
382              has been instantiated with. If the parsed number overflows this type
383              the parsing fails. Please be aware that the overflow check is not based
384              on the type of the supplied attribute but solely depends on the template
385              parameter <code class="computeroutput"><span class="identifier">T</span></code>.
386            </p></td></tr>
387</table></div>
388<h6>
389<a name="spirit.qi.reference.numeric.int.h7"></a>
390            <span class="phrase"><a name="spirit.qi.reference.numeric.int.attributes"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.attributes">Attributes</a>
391          </h6>
392<div class="informaltable"><table class="table">
393<colgroup>
394<col>
395<col>
396</colgroup>
397<thead><tr>
398<th>
399                    <p>
400                      Expression
401                    </p>
402                  </th>
403<th>
404                    <p>
405                      Attribute
406                    </p>
407                  </th>
408</tr></thead>
409<tbody>
410<tr>
411<td>
412                    <p>
413</p>
414<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">lit</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
415</pre>
416<p>
417                    </p>
418                  </td>
419<td>
420                    <p>
421                      <code class="computeroutput"><span class="identifier">unused</span></code>
422                    </p>
423                  </td>
424</tr>
425<tr>
426<td>
427                    <p>
428</p>
429<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">short_</span>
430<span class="identifier">short_</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
431</pre>
432<p>
433                    </p>
434                  </td>
435<td>
436                    <p>
437                      <code class="computeroutput"><span class="keyword">short</span></code>
438                    </p>
439                  </td>
440</tr>
441<tr>
442<td>
443                    <p>
444</p>
445<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">int_</span>
446<span class="identifier">int_</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
447</pre>
448<p>
449                    </p>
450                  </td>
451<td>
452                    <p>
453                      <code class="computeroutput"><span class="keyword">int</span></code>
454                    </p>
455                  </td>
456</tr>
457<tr>
458<td>
459                    <p>
460</p>
461<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">long_</span>
462<span class="identifier">long_</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
463</pre>
464<p>
465                    </p>
466                  </td>
467<td>
468                    <p>
469                      <code class="computeroutput"><span class="keyword">long</span></code>
470                    </p>
471                  </td>
472</tr>
473<tr>
474<td>
475                    <p>
476</p>
477<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">long_long</span>
478<span class="identifier">long_long</span><span class="special">(</span><span class="identifier">num</span><span class="special">)</span>
479</pre>
480<p>
481                    </p>
482                  </td>
483<td>
484                    <p>
485                      <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">long_long_type</span></code>
486                    </p>
487                  </td>
488</tr>
489<tr>
490<td>
491                    <p>
492</p>
493<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">int_parser</span><span class="special">&lt;</span>
494    <span class="identifier">T</span><span class="special">,</span> <span class="identifier">Radix</span><span class="special">,</span> <span class="identifier">MinDigits</span><span class="special">,</span> <span class="identifier">MaxDigits</span>
495<span class="special">&gt;()</span>
496<span class="identifier">int_parser</span><span class="special">&lt;</span>
497    <span class="identifier">T</span><span class="special">,</span> <span class="identifier">Radix</span><span class="special">,</span> <span class="identifier">MinDigits</span><span class="special">,</span> <span class="identifier">MaxDigits</span>
498<span class="special">&gt;()(</span><span class="identifier">num</span><span class="special">)</span>
499</pre>
500<p>
501                    </p>
502                  </td>
503<td>
504                    <p>
505                      <code class="computeroutput"><span class="identifier">T</span></code>
506                    </p>
507                  </td>
508</tr>
509</tbody>
510</table></div>
511<h6>
512<a name="spirit.qi.reference.numeric.int.h8"></a>
513            <span class="phrase"><a name="spirit.qi.reference.numeric.int.complexity"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.complexity">Complexity</a>
514          </h6>
515<div class="blockquote"><blockquote class="blockquote"><p>
516              O(N), where N is the number of digits being parsed plus the sign.
517            </p></blockquote></div>
518<h6>
519<a name="spirit.qi.reference.numeric.int.h9"></a>
520            <span class="phrase"><a name="spirit.qi.reference.numeric.int.minimum_expression_requirements_for__code__phrase_role__identifier__t__phrase___code_"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.minimum_expression_requirements_for__code__phrase_role__identifier__t__phrase___code_">Minimum
521            Expression Requirements for <code class="computeroutput"><span class="identifier">T</span></code></a>
522          </h6>
523<p>
524            For the numeric base type, <code class="computeroutput"><span class="identifier">T</span></code>,
525            the expression requirements below must be valid:
526          </p>
527<div class="informaltable"><table class="table">
528<colgroup>
529<col>
530<col>
531</colgroup>
532<thead><tr>
533<th>
534                    <p>
535                      Expression
536                    </p>
537                  </th>
538<th>
539                    <p>
540                      Semantics
541                    </p>
542                  </th>
543</tr></thead>
544<tbody>
545<tr>
546<td>
547                    <p>
548                      <code class="computeroutput"><span class="identifier">T</span><span class="special">()</span></code>
549                    </p>
550                  </td>
551<td>
552                    <p>
553                      Default construct.
554                    </p>
555                  </td>
556</tr>
557<tr>
558<td>
559                    <p>
560                      <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="number">0</span><span class="special">)</span></code>
561                    </p>
562                  </td>
563<td>
564                    <p>
565                      Construct from an <code class="computeroutput"><span class="keyword">int</span></code>.
566                    </p>
567                  </td>
568</tr>
569<tr>
570<td>
571                    <p>
572                      <code class="computeroutput"><span class="identifier">n</span> <span class="special">+</span>
573                      <span class="identifier">n</span></code>
574                    </p>
575                  </td>
576<td>
577                    <p>
578                      Addition.
579                    </p>
580                  </td>
581</tr>
582<tr>
583<td>
584                    <p>
585                      <code class="computeroutput"><span class="identifier">n</span> <span class="special">-</span>
586                      <span class="identifier">n</span></code>
587                    </p>
588                  </td>
589<td>
590                    <p>
591                      Subtraction.
592                    </p>
593                  </td>
594</tr>
595<tr>
596<td>
597                    <p>
598                      <code class="computeroutput"><span class="identifier">n</span> <span class="special">*</span>
599                      <span class="identifier">n</span></code>
600                    </p>
601                  </td>
602<td>
603                    <p>
604                      Multiplication.
605                    </p>
606                  </td>
607</tr>
608<tr>
609<td>
610                    <p>
611                      <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">is_bounded</span></code>
612                    </p>
613                  </td>
614<td>
615                    <p>
616                      <code class="computeroutput"><span class="keyword">true</span></code> or <code class="computeroutput"><span class="keyword">false</span></code> if <code class="computeroutput"><span class="identifier">T</span></code>
617                      bounded.
618                    </p>
619                  </td>
620</tr>
621<tr>
622<td>
623                    <p>
624                      <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">digits</span></code>
625                    </p>
626                  </td>
627<td>
628                    <p>
629                      Maximum Digits for <code class="computeroutput"><span class="identifier">T</span></code>,
630                      radix digits. Required only if <code class="computeroutput"><span class="identifier">T</span></code>
631                      is bounded.
632                    </p>
633                  </td>
634</tr>
635<tr>
636<td>
637                    <p>
638                      <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">digits10</span></code>
639                    </p>
640                  </td>
641<td>
642                    <p>
643                      Maximum Digits for <code class="computeroutput"><span class="identifier">T</span></code>,
644                      base 10. Required only if <code class="computeroutput"><span class="identifier">T</span></code>
645                      is bounded.
646                    </p>
647                  </td>
648</tr>
649<tr>
650<td>
651                    <p>
652                      <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">max</span><span class="special">()</span></code>
653                    </p>
654                  </td>
655<td>
656                    <p>
657                      Maximum value for <code class="computeroutput"><span class="identifier">T</span></code>.
658                      Required only if <code class="computeroutput"><span class="identifier">T</span></code>
659                      is bounded.
660                    </p>
661                  </td>
662</tr>
663<tr>
664<td>
665                    <p>
666                      <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">min</span><span class="special">()</span></code>
667                    </p>
668                  </td>
669<td>
670                    <p>
671                      Minimum value for <code class="computeroutput"><span class="identifier">T</span></code>.
672                      Required only if <code class="computeroutput"><span class="identifier">T</span></code>
673                      is bounded.
674                    </p>
675                  </td>
676</tr>
677</tbody>
678</table></div>
679<h6>
680<a name="spirit.qi.reference.numeric.int.h10"></a>
681            <span class="phrase"><a name="spirit.qi.reference.numeric.int.example"></a></span><a class="link" href="int.html#spirit.qi.reference.numeric.int.example">Example</a>
682          </h6>
683<div class="note"><table border="0" summary="Note">
684<tr>
685<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../images/note.png"></td>
686<th align="left">Note</th>
687</tr>
688<tr><td align="left" valign="top"><p>
689              The test harness for the example(s) below is presented in the <a class="link" href="../basics.html#spirit.qi.reference.basics.examples">Basics Examples</a>
690              section.
691            </p></td></tr>
692</table></div>
693<p>
694            Some using declarations:
695          </p>
696<p>
697</p>
698<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">val</span><span class="special">;</span>
699<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">::</span><span class="identifier">lit</span><span class="special">;</span>
700<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">::</span><span class="identifier">int_</span><span class="special">;</span>
701</pre>
702<p>
703          </p>
704<p>
705            Basic signed integers:
706          </p>
707<p>
708</p>
709<pre class="programlisting"><span class="comment">// signed int</span>
710<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"+12345"</span><span class="special">,</span> <span class="identifier">int_</span><span class="special">);</span>
711<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"-12345"</span><span class="special">,</span> <span class="identifier">int_</span><span class="special">);</span>
712<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"+12345"</span><span class="special">,</span> <span class="identifier">int_</span><span class="special">(</span><span class="number">12345</span><span class="special">));</span>
713<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"-12345"</span><span class="special">,</span> <span class="identifier">int_</span><span class="special">(-</span><span class="number">12345</span><span class="special">));</span>
714<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"+12345"</span><span class="special">,</span> <span class="identifier">int_</span><span class="special">(</span><span class="identifier">val</span><span class="special">(</span><span class="number">12345</span><span class="special">)));</span>
715<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"-12345"</span><span class="special">,</span> <span class="identifier">int_</span><span class="special">(</span><span class="identifier">val</span><span class="special">(-</span><span class="number">12345</span><span class="special">)));</span>
716
717<span class="comment">// literals</span>
718<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"+12345"</span><span class="special">,</span> <span class="identifier">lit</span><span class="special">(</span><span class="number">12345</span><span class="special">));</span>
719<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"-12345"</span><span class="special">,</span> <span class="identifier">lit</span><span class="special">(-</span><span class="number">12345</span><span class="special">));</span>
720<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"+12345"</span><span class="special">,</span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">val</span><span class="special">(</span><span class="number">12345</span><span class="special">)));</span>
721<span class="identifier">test_parser</span><span class="special">(</span><span class="string">"-12345"</span><span class="special">,</span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">val</span><span class="special">(-</span><span class="number">12345</span><span class="special">)));</span>
722</pre>
723<p>
724          </p>
725</div>
726<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
727<td align="left"></td>
728<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
729        Distributed under the Boost Software License, Version 1.0. (See accompanying
730        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
731      </p>
732</div></td>
733</tr></table>
734<hr>
735<div class="spirit-nav">
736<a accesskey="p" href="uint.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../numeric.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="real.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
737</div>
738</body>
739</html>
740