/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
FWCore/PythonParameterSet/interface/PyBind11Wrapper.h
34 строки
891 B
W. David Dagenhart
Changes from scram build code-format-all
03 май 2019, 18:48
03 май 2019, 18:48
22c28dc
Код
Авторство
О чём код?
#ifndef FWCore_PyBind11ParameterSet_PyBind11Wrapper_h #define FWCore_PyBind11ParameterSet_PyBind11Wrapper_h #include <vector> #include <string> #include <pybind11/pybind11.h> #include <pybind11/stl.h> #include <iostream> namespace edm { void pythonToCppException(const std::string& iType, const std::string& error); // utility to translate from an STL vector of strings to // a Python list template <typename T> pybind11::list toPython11List(const std::vector<T>& v) { pybind11::list result = pybind11::cast(v); return result; } // and back. Destroys the input via pop()s - well probably not template <typename T> std::vector<T> toVector(pybind11::list& l) { std::vector<T> result; result.reserve(l.size()); for (unsigned i = 0; i < l.size(); ++i) { result.push_back(l[i].cast<T>()); } return result; } } // namespace edm #endif