Skip to content

Instantly share code, notes, and snippets.

View kashefy's full-sized avatar

Youssef Kashef kashefy

  • Berlin, Germany
View GitHub Profile
@octavifs
octavifs / std::vector_to_boost::python::list.cpp
Last active June 7, 2017 12:32
Converts C++ std::vector to boost::python::list
// Converts a C++ vector to a python list
template <class T>
boost::python::list toPythonList(std::vector<T> vector) {
typename std::vector<T>::iterator iter;
boost::python::list list;
for (iter = vector.begin(); iter != vector.end(); ++iter) {
list.append(*iter);
}
return list;
}