blob: d39bc91a0cd6769674c1e24afa96b1930ea314fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#pragma once
#include "std/vector.hpp"
#include <boost/python.hpp>
namespace
{
template <typename T>
vector<T> python_list_to_std_vector(boost::python::object const & iterable)
{
return vector<T>(boost::python::stl_input_iterator<T>(iterable),
boost::python::stl_input_iterator<T>());
}
template <typename T>
boost::python::list std_vector_to_python_list(vector<T> const & v)
{
boost::python::object get_iter = boost::python::iterator<vector<T>>();
return boost::python::list(get_iter(v));
}
} // namespace
|