Last change
on this file since 29 was
29,
checked in by landauf, 16 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
987 bytes
|
Line | |
---|
1 | // Copyright David Abrahams 2004. Distributed under the Boost |
---|
2 | // Software License, Version 1.0. (See accompanying |
---|
3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
---|
4 | #include <boost/python/module.hpp> |
---|
5 | #include <boost/python/def.hpp> |
---|
6 | #include <boost/python/class.hpp> |
---|
7 | #include <boost/python/reference_existing_object.hpp> |
---|
8 | #include <boost/python/return_value_policy.hpp> |
---|
9 | |
---|
10 | struct A {}; |
---|
11 | |
---|
12 | struct V |
---|
13 | { |
---|
14 | |
---|
15 | virtual void f() = 0; |
---|
16 | |
---|
17 | const A* inside() {return &a;} |
---|
18 | |
---|
19 | A a; |
---|
20 | }; |
---|
21 | |
---|
22 | const A* outside(const V& v) {return &v.a;} |
---|
23 | |
---|
24 | BOOST_PYTHON_MODULE(bienstman1_ext) |
---|
25 | { |
---|
26 | using namespace boost::python; |
---|
27 | using boost::shared_ptr; |
---|
28 | using boost::python::return_value_policy; |
---|
29 | using boost::python::reference_existing_object; |
---|
30 | |
---|
31 | class_<A>("A"); |
---|
32 | |
---|
33 | class_<V, boost::noncopyable>("V", no_init) |
---|
34 | .def("inside", &V::inside, |
---|
35 | return_value_policy<reference_existing_object>()) |
---|
36 | .def("outside", outside, |
---|
37 | return_value_policy<reference_existing_object>()) |
---|
38 | ; |
---|
39 | } |
---|
40 | |
---|
Note: See
TracBrowser
for help on using the repository browser.