ppap4lmp  0.7.2
pyargs_to_vec.cpp
Go to the documentation of this file.
1 
8 #include "pyargs_to_vec.h"
9 
10 namespace ut = utils;
11 
12 /* ------------------------------------------------------------------ */
13 
14 template<typename T>
16  const py::args &args,
17  Vec<T> &vec)
18 {
19  vec.clear();
20 
21  for (const auto &arg : args)
22  {
23  vec.push_back(arg.cast<T>());
24  }
25 }
26 
27 /* ------------------------------------------------------------------ */
28 
29 /* NOTE:
30  Template functions used by pybind11 must be instantiated.
31 */
32 
33 template void ut::pyargs_to_vec(
34  const py::args &, Vec<Str> &);
This file has a definition of utils::pyargs_to_vec.
void pyargs_to_vec(const py::args &args, Vec< T > &vec)
Convert a py::args (a variable number arguments) object to a Vec object.
std::vector< T > Vec
Vec is an alias for vector (same as list in Python).
Definition: std.h:27
Namespace for utility functions.
Definition: join.h:14