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:
882 bytes
|
Rev | Line | |
---|
[29] | 1 | // Copyright David Abrahams 2005. 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 | |
---|
| 5 | #include <boost/python/module.hpp> |
---|
| 6 | #include <boost/python/def.hpp> |
---|
| 7 | #include <boost/python/class.hpp> |
---|
| 8 | #include <boost/python/tuple.hpp> |
---|
| 9 | |
---|
| 10 | using namespace boost::python; |
---|
| 11 | |
---|
| 12 | object convert_to_tuple(object data) |
---|
| 13 | { |
---|
| 14 | return tuple(data); |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | void test_operators(tuple t1, tuple t2, object print) |
---|
| 18 | { |
---|
| 19 | print(t1 + t2); |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | tuple mktuple0() { return make_tuple(); } |
---|
| 23 | tuple mktuple1(int x) { return make_tuple(x); } |
---|
| 24 | tuple mktuple2(char const* a1, int x) { return make_tuple(a1, x); } |
---|
| 25 | |
---|
| 26 | BOOST_PYTHON_MODULE(tuple_ext) |
---|
| 27 | { |
---|
| 28 | def("convert_to_tuple",convert_to_tuple); |
---|
| 29 | def("test_operators",test_operators); |
---|
| 30 | def("make_tuple", mktuple0); |
---|
| 31 | def("make_tuple", mktuple1); |
---|
| 32 | def("make_tuple", mktuple2); |
---|
| 33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.