21 #define KDBINDINGS_DEFINE_UNARY_OP(OP) \
22 template<typename... T> \
23 inline auto operator OP(Property<T...> &arg) noexcept(noexcept(OP arg.get())) \
24 ->Private::Node<std::decay_t<decltype(OP arg.get())>> \
26 return Private::makeNode([](auto &&v) { return (OP v); }, arg); \
29 template<typename T> \
30 inline auto operator OP(Private::Node<T> &&arg) noexcept(noexcept(OP arg.evaluate())) \
31 ->Private::Node<std::decay_t<decltype(OP arg.evaluate())>> \
33 return Private::makeNode([](auto &&v) { return (OP v); }, std::move(arg)); \
55 #define KDBINDINGS_DEFINE_BINARY_OP(OP) \
56 template<typename B, typename... A> \
57 inline auto operator OP(Property<A...> &a, B &&b) noexcept(noexcept(a.get() OP b)) \
58 ->std::enable_if_t<!Private::is_bindable<B>::value, \
59 Private::Node<decltype(a.get() OP b)>> \
61 return Private::makeNode([](auto &&av, auto &&bv) { return (av OP bv); }, a, std::forward<B>(b)); \
64 template<typename A, typename... B> \
65 inline auto operator OP(A &&a, Property<B...> &b) noexcept(noexcept(a OP b.get())) \
66 ->std::enable_if_t<!Private::is_bindable<A>::value, \
67 Private::Node<decltype(a OP b.get())>> \
69 return Private::makeNode([](auto &&av, auto &&bv) { return (av OP bv); }, std::forward<A>(a), b); \
72 template<typename A, typename B> \
73 inline auto operator OP(Property<A> &a, Property<B> &b) noexcept(noexcept(a.get() OP b.get())) \
74 ->Private::Node<decltype(a.get() OP b.get())> \
76 return Private::makeNode([](auto &&av, auto &&bv) { return (av OP bv); }, a, b); \
79 template<typename A, typename B> \
80 inline auto operator OP(Private::Node<A> &&a, B &&b) noexcept(noexcept(a.evaluate() OP b)) \
81 ->std::enable_if_t<!Private::is_bindable<B>::value, \
82 Private::Node<decltype(a.evaluate() OP b)>> \
84 return Private::makeNode([](auto &&av, auto &&bv) { return (av OP bv); }, std::move(a), std::forward<B>(b)); \
87 template<typename A, typename B> \
88 inline auto operator OP(A &&a, Private::Node<B> &&b) noexcept(noexcept(a OP b.evaluate())) \
89 ->std::enable_if_t<!Private::is_bindable<A>::value, \
90 Private::Node<decltype(a OP b.evaluate())>> \
92 return Private::makeNode([](auto &&av, auto &&bv) { return (av OP bv); }, std::forward<A>(a), std::move(b)); \
95 template<typename A, typename B> \
96 inline auto operator OP(Private::Node<A> &&a, Private::Node<B> &&b) noexcept(noexcept(a.evaluate() OP b.evaluate())) \
97 ->Private::Node<decltype(a.evaluate() OP b.evaluate())> \
99 return Private::makeNode([](auto &&av, auto &&bv) { return (av OP bv); }, std::move(a), std::move(b)); \
102 template<typename B, typename A> \
103 inline auto operator OP(Property<A> &a, Private::Node<B> &&b) noexcept(noexcept(a.get() OP b.evaluate())) \
104 ->Private::Node<decltype(a.get() OP b.evaluate())> \
106 return Private::makeNode([](auto &&av, auto &&bv) { return (av OP bv); }, a, std::move(b)); \
109 template<typename A, typename B> \
110 inline auto operator OP(Private::Node<A> &&a, Property<B> &b) noexcept(noexcept(a.evaluate() OP b.get())) \
111 ->Private::Node<decltype(a.evaluate() OP b.get())> \
113 return Private::makeNode([](auto &&av, auto &&bv) { return (av OP bv); }, std::move(a), b); \
The main namespace of the KDBindings library.
#define KDBINDINGS_DEFINE_UNARY_OP(OP)
#define KDBINDINGS_DEFINE_BINARY_OP(OP)