Skip to content
Snippets Groups Projects
Commit 49916ff3 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Add to_std_vector

parent 95b27447
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ namespace bp = boost::python; ...@@ -17,7 +17,7 @@ namespace bp = boost::python;
namespace dynamicgraph { namespace dynamicgraph {
namespace python { namespace python {
template <typename Iterator> template <typename Iterator> inline
bp::list to_py_list(Iterator begin, Iterator end) { bp::list to_py_list(Iterator begin, Iterator end) {
typedef typename Iterator::value_type T; typedef typename Iterator::value_type T;
bp::list lst; bp::list lst;
...@@ -25,11 +25,18 @@ bp::list to_py_list(Iterator begin, Iterator end) { ...@@ -25,11 +25,18 @@ bp::list to_py_list(Iterator begin, Iterator end) {
return lst; return lst;
} }
template <typename Iterator> template <typename Iterator> inline
bp::tuple to_py_tuple(Iterator begin, Iterator end) { bp::tuple to_py_tuple(Iterator begin, Iterator end) {
return bp::tuple(to_py_list(begin, end)); return bp::tuple(to_py_list(begin, end));
} }
template<typename T> inline
std::vector< T > to_std_vector( const bp::object& iterable )
{
return std::vector< T >( bp::stl_input_iterator< T >( iterable ),
bp::stl_input_iterator< T >( ) );
}
void exposeSignals(); void exposeSignals();
// Declare functions defined in other source files // Declare functions defined in other source files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment