#pragma once #include #include namespace python = boost::python; namespace pykd { template inline python::list vectorToList( const std::vector &v ) { python::list lst; for ( std::vector::const_iterator it = v.begin(); it != v.end(); ++it ) lst.append( *it ); return lst; } template<> inline python::list vectorToList( const std::vector &v ) { python::list lst; for ( std::vector::const_iterator it = v.begin(); it != v.end(); ++it ) lst.append( int(*it) ); return lst; } template inline std::vector listToVector( const python::list &lst ) { std::vector vec( python::len(lst) ); for ( long i = 0; i < python::len(lst); ++i ) { T v = python::extract(lst[i]); vec[i] =v; } return vec; } } // end namespace pykd