19 #ifndef PYSTON_HELPERS_H
20 #define PYSTON_HELPERS_H
24 #include <boost/python.hpp>
25 #include <boost/mpl/vector.hpp>
30 template <
typename Signature>
36 template <
typename R,
typename... Args>
39 return boost::python::make_function(
40 FunctionFactory<R(Args...)>(repr, functor), boost::python::default_call_policies(),
49 template <
typename R,
typename... Args>
52 auto wrapped = [functor](
const Context&, Args... args) {
return functor(args...); };
53 return boost::python::make_function(
54 FunctionFactory<R(Args...)>(repr, wrapped), boost::python::default_call_policies(),
59 template <
typename Signature>
70 template <
typename R,
typename T>
76 return boost::python::make_function(
79 return factory(right, left);
80 return factory(left, right);
82 boost::python::default_call_policies(),
84 const std::shared_ptr<Node<T>>&>());
103 template <
typename Signature>
123 template <
typename Signature>
125 bool reversed =
false) {
131 #endif // PYSTON_HELPERS_H
static boost::python::object makeBinaryFunction(const std::string &repr, std::function< Signature > functor, bool reversed=false)
static boost::python::object makeFunction(const std::string &repr, std::function< Signature > functor)
static boost::python::object make(const std::string &repr, std::function< R(const Context &, Args...)> functor)
static boost::python::object make(const std::string &repr, std::function< R(T, T)> functor, bool reversed)
static boost::python::object make(const std::string &repr, std::function< R(Args...)> functor)