MCPcopy Create free account
hub / github.com/davisking/dlib / python_list_to_vector

Function python_list_to_vector

dlib/python/pybind_utils.h:18–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17 template <typename T>
18 std::vector<T> python_list_to_vector (
19 const py::list& obj
20 )
21 /*!
22 ensures
23 - converts a python object into a std::vector<T> and returns it.
24 !*/
25 {
26 std::vector<T> vect(len(obj));
27 for (unsigned long i = 0; i < vect.size(); ++i)
28 {
29 vect[i] = obj[i].cast<T>();
30 }
31 return vect;
32 }
33
34 template <typename T,size_t N>
35 std::array<T,N> python_list_to_array (

Callers

nothing calls this directly

Calls 2

lenFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected