2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-20 16:52:15 +00:00

fixed problem reported by Neal Becker; added a test case

[SVN r39223]
This commit is contained in:
Nikolay Mladenov
2007-09-12 21:31:39 +00:00
parent 5809078ba9
commit 62ef542eaf
2 changed files with 20 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ struct functions
}
static shared_ptr<T> get() { return storage; }
static shared_ptr<T> &get1() { return storage; }
static int look_store()
{
@@ -71,6 +72,8 @@ struct functions
.staticmethod("identity")
.def("null", &null)
.staticmethod("null")
.def("get1", &get1, return_internal_reference<>())
.staticmethod("get1")
.def("get", &get)
.staticmethod("get")
.def("count", &T::count)
@@ -154,6 +157,14 @@ shared_ptr<Y> factory(int n)
// ------
// from Neal Becker
struct Test {
boost::shared_ptr<X> x;
};
// ------
BOOST_PYTHON_MODULE(shared_ptr_ext)
{
class_<A, boost::shared_ptr<A_Wrapper>, boost::noncopyable>("A")
@@ -193,6 +204,12 @@ BOOST_PYTHON_MODULE(shared_ptr_ext)
.def("value", &Z::value)
.def("v", &Z::v, &ZWrap::default_v)
);
// from Neal Becker
class_<Test> ("Test")
.def_readonly ("x", &Test::x, "x")
;
// ------
}
#include "module_tail.cpp"