Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.


Class long_

Exposes a TypeWrapper for the Python long integer type.

Exposes the numeric type protocol of Python's built-in long type. The semantics of the constructors and member functions defined below can be fully understood by reading the TypeWrapper concept definition. Since long_ is publicly derived from object, the public object interface applies to long_ instances as well.

namespace boost { namespace python
  class long_ : public object
      long_(); // new long_

      template <class T>
      explicit long_(T const& rhs);

      template <class T, class U>
      long_(T const& rhs, U const& base);
namespace python = boost::python;

// compute a factorial without overflowing
python::long_ fact(long n)
   if (n == 0)
      return python::long_(1);
      return n * fact(n - 1);