1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
2 | |
---|
3 | <!-- Copyright David Abrahams 2006. Distributed under the Boost --> |
---|
4 | <!-- Software License, Version 1.0. (See accompanying --> |
---|
5 | <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> |
---|
6 | <html> |
---|
7 | <head> |
---|
8 | <meta name="generator" content= |
---|
9 | "HTML Tidy for Windows (vers 1st August 2002), see www.w3.org"> |
---|
10 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
11 | <link rel="stylesheet" type="text/css" href="../boost.css"> |
---|
12 | |
---|
13 | <title>Boost.Python - <boost/python/long.hpp></title> |
---|
14 | </head> |
---|
15 | |
---|
16 | <body> |
---|
17 | <table border="0" cellpadding="7" cellspacing="0" width="100%" summary= |
---|
18 | "header"> |
---|
19 | <tr> |
---|
20 | <td valign="top" width="300"> |
---|
21 | <h3><a href="../../../../index.htm"><img height="86" width="277" |
---|
22 | alt="C++ Boost" src="../../../../boost.png" border="0"></a></h3> |
---|
23 | </td> |
---|
24 | |
---|
25 | <td valign="top"> |
---|
26 | <h1 align="center"><a href="../index.html">Boost.Python</a></h1> |
---|
27 | |
---|
28 | <h2 align="center">Header <boost/python/long.hpp></h2> |
---|
29 | </td> |
---|
30 | </tr> |
---|
31 | </table> |
---|
32 | <hr> |
---|
33 | |
---|
34 | <h2>Contents</h2> |
---|
35 | |
---|
36 | <dl class="page-index"> |
---|
37 | <dt><a href="#introduction">Introduction</a></dt> |
---|
38 | |
---|
39 | <dt><a href="#classes">Classes</a></dt> |
---|
40 | |
---|
41 | <dd> |
---|
42 | <dl class="page-index"> |
---|
43 | <dt><a href="#long_-spec">Class <code>long_</code></a></dt> |
---|
44 | |
---|
45 | <dd> |
---|
46 | <dl class="page-index"> |
---|
47 | <dt><a href="#long_-spec-synopsis">Class <code>long_</code> |
---|
48 | synopsis</a></dt> |
---|
49 | </dl> |
---|
50 | </dd> |
---|
51 | </dl> |
---|
52 | </dd> |
---|
53 | |
---|
54 | <dt><a href="#examples">Example(s)</a></dt> |
---|
55 | </dl> |
---|
56 | <hr> |
---|
57 | |
---|
58 | <h2><a name="introduction"></a>Introduction</h2> |
---|
59 | |
---|
60 | <p>Exposes a <a href= |
---|
61 | "ObjectWrapper.html#TypeWrapper-concept">TypeWrapper</a> for the Python |
---|
62 | <a href= |
---|
63 | "http://www.python.org/doc/current/lib/typesnumeric.html">long</a> |
---|
64 | integer type.</p> |
---|
65 | |
---|
66 | <h2><a name="classes"></a>Classes</h2> |
---|
67 | |
---|
68 | <h3><a name="long_-spec"></a>Class <code>long_</code></h3> |
---|
69 | |
---|
70 | <p>Exposes the <a href= |
---|
71 | "http://www.python.org/doc/current/lib/typesnumeric.html">numeric type |
---|
72 | protocol</a> of Python's built-in <code>long</code> type. The semantics |
---|
73 | of the constructors and member functions defined below can be fully |
---|
74 | understood by reading the <a href= |
---|
75 | "ObjectWrapper.html#TypeWrapper-concept">TypeWrapper</a> concept |
---|
76 | definition. Since <code>long_</code> is publicly derived from <code><a |
---|
77 | href="object.html#object-spec">object</a></code>, the public object |
---|
78 | interface applies to <code>long_</code> instances as well.</p> |
---|
79 | |
---|
80 | <h4><a name="long_-spec-synopsis"></a>Class <code>long_</code> |
---|
81 | synopsis</h4> |
---|
82 | <pre> |
---|
83 | namespace boost { namespace python |
---|
84 | { |
---|
85 | class long_ : public object |
---|
86 | { |
---|
87 | public: |
---|
88 | long_(); // new long_ |
---|
89 | |
---|
90 | template <class T> |
---|
91 | explicit long_(T const& rhs); |
---|
92 | |
---|
93 | template <class T, class U> |
---|
94 | long_(T const& rhs, U const& base); |
---|
95 | }; |
---|
96 | }} |
---|
97 | </pre> |
---|
98 | |
---|
99 | <h2><a name="examples"></a>Example</h2> |
---|
100 | <pre> |
---|
101 | namespace python = boost::python; |
---|
102 | |
---|
103 | // compute a factorial without overflowing |
---|
104 | python::long_ fact(long n) |
---|
105 | { |
---|
106 | if (n == 0) |
---|
107 | return python::long_(1); |
---|
108 | else |
---|
109 | return n * fact(n - 1); |
---|
110 | } |
---|
111 | </pre> |
---|
112 | |
---|
113 | <p>Revised 1 October, 2002</p> |
---|
114 | |
---|
115 | <p><i>© Copyright <a href= |
---|
116 | "../../../../people/dave_abrahams.htm">Dave Abrahams</a> 2002.</i></p> |
---|
117 | </body> |
---|
118 | </html> |
---|
119 | |
---|