Last change
on this file since 45 was
29,
checked in by landauf, 17 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
1001 bytes
|
Line | |
---|
1 | // Copyright David Abrahams 2002. |
---|
2 | // Distributed under the Boost Software License, Version 1.0. (See |
---|
3 | // accompanying file LICENSE_1_0.txt or copy at |
---|
4 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
5 | #include <boost/python/class.hpp> |
---|
6 | #include <boost/python/implicit.hpp> |
---|
7 | #include <boost/python/module.hpp> |
---|
8 | #include <boost/python/def.hpp> |
---|
9 | #include "test_class.hpp" |
---|
10 | |
---|
11 | using namespace boost::python; |
---|
12 | |
---|
13 | typedef test_class<> X; |
---|
14 | |
---|
15 | int x_value(X const& x) |
---|
16 | { |
---|
17 | return x.value(); |
---|
18 | } |
---|
19 | |
---|
20 | X make_x(int n) { return X(n); } |
---|
21 | |
---|
22 | |
---|
23 | // foo/bar -- a regression for a vc7 bug workaround |
---|
24 | struct bar {}; |
---|
25 | struct foo |
---|
26 | { |
---|
27 | virtual void f() = 0; |
---|
28 | operator bar() const { return bar(); } |
---|
29 | }; |
---|
30 | |
---|
31 | BOOST_PYTHON_MODULE(implicit_ext) |
---|
32 | { |
---|
33 | implicitly_convertible<foo,bar>(); |
---|
34 | implicitly_convertible<int,X>(); |
---|
35 | |
---|
36 | def("x_value", x_value); |
---|
37 | def("make_x", make_x); |
---|
38 | |
---|
39 | class_<X>("X", init<int>()) |
---|
40 | .def("value", &X::value) |
---|
41 | .def("set", &X::set) |
---|
42 | ; |
---|
43 | |
---|
44 | implicitly_convertible<X,int>(); |
---|
45 | } |
---|
46 | |
---|
47 | #include "module_tail.cpp" |
---|
Note: See
TracBrowser
for help on using the repository browser.