19#ifndef PYSTON_HELPERS_H
20#define PYSTON_HELPERS_H
24#include <boost/python.hpp>
25#include <boost/mpl/vector.hpp>
30template <
typename Signature>
36template <
typename R,
typename... Args>
39 return boost::python::make_function(
40 FunctionFactory<R(Args...)>(repr, functor), boost::python::default_call_policies(),
49template <
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(),
59template <
typename Signature>
70template <
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(),
103template <
typename Signature>
123template <
typename Signature>
125 bool reversed =
false) {
static boost::python::object makeFunction(const std::string &repr, std::function< Signature > functor)
static boost::python::object makeBinaryFunction(const std::string &repr, std::function< Signature > functor, bool reversed=false)
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)
static boost::python::object make(const std::string &repr, std::function< R(const Context &, Args...)> functor)