81 template <op_
id, op_type,
typename B,
typename L,
typename R>
85 template <op_
id id, op_type ot,
typename L,
typename R>
87 template <
typename Class,
typename... Extra>
88 void execute(Class &
cl,
const Extra &...extra)
const {
95 template <
typename Class,
typename... Extra>
105 #define PYBIND11_BINARY_OPERATOR(id, rid, op, expr) \ 106 template <typename B, typename L, typename R> \ 107 struct op_impl<op_##id, op_l, B, L, R> { \ 108 static char const *name() { return "__" #id "__"; } \ 109 static auto execute(const L &l, const R &r) -> decltype(expr) { return (expr); } \ 110 static B execute_cast(const L &l, const R &r) { return B(expr); } \ 112 template <typename B, typename L, typename R> \ 113 struct op_impl<op_##id, op_r, B, L, R> { \ 114 static char const *name() { return "__" #rid "__"; } \ 115 static auto execute(const R &r, const L &l) -> decltype(expr) { return (expr); } \ 116 static B execute_cast(const R &r, const L &l) { return B(expr); } \ 118 inline op_<op_##id, op_l, self_t, self_t> op(const self_t &, const self_t &) { \ 119 return op_<op_##id, op_l, self_t, self_t>(); \ 121 template <typename T> \ 122 op_<op_##id, op_l, self_t, T> op(const self_t &, const T &) { \ 123 return op_<op_##id, op_l, self_t, T>(); \ 125 template <typename T> \ 126 op_<op_##id, op_r, T, self_t> op(const T &, const self_t &) { \ 127 return op_<op_##id, op_r, T, self_t>(); \ 130 #define PYBIND11_INPLACE_OPERATOR(id, op, expr) \ 131 template <typename B, typename L, typename R> \ 132 struct op_impl<op_##id, op_l, B, L, R> { \ 133 static char const *name() { return "__" #id "__"; } \ 134 static auto execute(L &l, const R &r) -> decltype(expr) { return expr; } \ 135 static B execute_cast(L &l, const R &r) { return B(expr); } \ 137 template <typename T> \ 138 op_<op_##id, op_l, self_t, T> op(const self_t &, const T &) { \ 139 return op_<op_##id, op_l, self_t, T>(); \ 142 #define PYBIND11_UNARY_OPERATOR(id, op, expr) \ 143 template <typename B, typename L> \ 144 struct op_impl<op_##id, op_u, B, L, undefined_t> { \ 145 static char const *name() { return "__" #id "__"; } \ 146 static auto execute(const L &l) -> decltype(expr) { return expr; } \ 147 static B execute_cast(const L &l) { return B(expr); } \ 149 inline op_<op_##id, op_u, self_t, undefined_t> op(const self_t &) { \ 150 return op_<op_##id, op_u, self_t, undefined_t>(); \ 192 #undef PYBIND11_BINARY_OPERATOR 193 #undef PYBIND11_INPLACE_OPERATOR 194 #undef PYBIND11_UNARY_OPERATOR typename std::conditional< B, T, F >::type conditional_t
Operator implementation generator.
#define PYBIND11_UNARY_OPERATOR(id, op, expr)
double mul(const double &a, const double &b)
Type for an unused type slot.
Rot2 R(Rot2::fromAngle(0.1))
#define PYBIND11_INPLACE_OPERATOR(id, op, expr)
Annotation for operators.
#define PYBIND11_NAMESPACE
op_id
Enumeration with all supported operator types.
void execute(Class &cl, const Extra &...extra) const
static const Line3 l(Rot3(), 1, 1)
base template of operator implementations
EIGEN_DONT_INLINE T sub(T a, T b)
self_t __self()
Don't warn about an unused variable.
#define PYBIND11_BINARY_OPERATOR(id, rid, op, expr)
graph add(PriorFactor< Pose2 >(1, priorMean, priorNoise))
void execute_cast(Class &cl, const Extra &...extra) const
#define PYBIND11_NAMESPACE_END(name)
#define PYBIND11_NAMESPACE_BEGIN(name)