Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/test/tuple.cpp @ 29

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
Line 
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
10using namespace boost::python;
11
12object convert_to_tuple(object data)
13{
14    return tuple(data);
15}
16
17void test_operators(tuple t1, tuple t2, object print)
18{
19    print(t1 + t2);
20}
21
22tuple mktuple0() { return make_tuple(); }
23tuple mktuple1(int x) { return make_tuple(x); }
24tuple mktuple2(char const* a1, int x) { return make_tuple(a1, x); }
25
26BOOST_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.