1 // (C) Copyright 2006 Douglas Gregor <doug.gregor -at- gmail.com>
3 // Use, modification and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 // Authors: Douglas Gregor
9 #include <boost/parallel/mpi/python.hpp>
10 #include <boost/python.hpp>
11 #include <boost/serialization/list.hpp>
12 using namespace boost::python
;
15 boost::python::list
list_to_python(const std::list
<T
>& value
) {
16 boost::python::list result
;
17 for (typename
std::list
<T
>::const_iterator i
= value
.begin();
18 i
!= value
.end(); ++i
)
23 BOOST_PYTHON_MODULE(skeleton_content
)
25 using boost::python::arg
;
27 class_
<std::list
<int> >("list_int")
28 .def("push_back", &std::list
<int>::push_back
, arg("value"))
29 .def("pop_back", &std::list
<int>::pop_back
)
30 .def("reverse", &std::list
<int>::reverse
)
31 .def(boost::python::self
== boost::python::self
)
32 .def(boost::python::self
!= boost::python::self
)
33 .add_property("size", &std::list
<int>::size
)
34 .def("to_python", &list_to_python
<int>);
36 boost::parallel::mpi::python::register_skeleton_and_content
<std::list
<int> >();