mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 19:53:22 +08:00
27 lines
624 B
C
27 lines
624 B
C
![]() |
#pragma once
|
||
|
|
||
|
#include <vector>
|
||
|
|
||
|
#include <boost/python/list.hpp>
|
||
|
namespace python = boost::python;
|
||
|
|
||
|
namespace pykd {
|
||
|
|
||
|
template<typename T>
|
||
|
python::list vectorToList( const std::vector<T> &v ) {
|
||
|
python::list lst;
|
||
|
for ( std::vector<T>::const_iterator it = v.begin(); it != v.end(); ++it )
|
||
|
lst.append( *it );
|
||
|
return lst;
|
||
|
}
|
||
|
|
||
|
template<>
|
||
|
python::list vectorToList<char>( const std::vector<char> &v ) {
|
||
|
python::list lst;
|
||
|
for ( std::vector<char>::const_iterator it = v.begin(); it != v.end(); ++it )
|
||
|
lst.append( int(*it) );
|
||
|
return lst;
|
||
|
}
|
||
|
|
||
|
} // end namespace pykd
|