mirror of
https://github.com/boostorg/python.git
synced 2026-01-20 16:52:15 +00:00
@@ -238,8 +238,8 @@ static MemberType& execute(InstanceType& c);
|
||||
|
||||
<h3>C++ module definition</h3>
|
||||
<pre>
|
||||
#include <boost/python/reference.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/lvalue_from_pytype.hpp>
|
||||
|
||||
// definition lifted from the Python docs
|
||||
typedef struct {
|
||||
@@ -247,7 +247,7 @@ typedef struct {
|
||||
} noddy_NoddyObject;
|
||||
|
||||
using namespace boost::python;
|
||||
static reference<PyObject> cache;
|
||||
static handle<> cache;
|
||||
|
||||
bool is_cached(noddy_NoddyObject* x)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ bool is_cached(noddy_NoddyObject* x)
|
||||
|
||||
void set_cache(noddy_NoddyObject* x)
|
||||
{
|
||||
cache.reset((PyObject*)x, ref::increment_count);
|
||||
cache = handle<>(borrowed(x));
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE(noddy_cache)
|
||||
|
||||
Reference in New Issue
Block a user