Files
opm-common/python/sunbeam/converters.hpp
Joakim Hove 77795b5005 Add 'python/' from commit '278373703455ea6562a0f8e5278b4db46eb1fc7e'
git-subtree-dir: python
git-subtree-mainline: e8dbf7d8ee
git-subtree-split: 2783737034
2019-05-08 07:20:29 +02:00

24 lines
446 B
C++

#ifndef SUNBEAM_CONVERTERS_HPP
#define SUNBEAM_CONVERTERS_HPP
#include <sstream>
#include <pybind11/pybind11.h>
namespace py = pybind11;
template< typename T >
py::list iterable_to_pylist( const T& v ) {
py::list l;
for( const auto& x : v ) l.append( x );
return l;
}
template< typename T >
std::string str( const T& t ) {
std::stringstream stream;
stream << t;
return stream.str();
}
#endif //SUNBEAM_CONVERTERS_HPP