Last active
June 7, 2017 12:32
-
-
Save octavifs/5362272 to your computer and use it in GitHub Desktop.
Converts C++ std::vector to boost::python::list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment