From fdd1b40a9f902b86946db49fd7b45078b6740f55 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sun, 29 May 2011 09:14:48 -0600 Subject: [PATCH] Significant reduction in templates instantiated by grouping of operators - smaller code and compile time --- .../chaiscript/dispatchkit/boxed_numeric.hpp | 622 +++++++++--------- 1 file changed, 301 insertions(+), 321 deletions(-) diff --git a/include/chaiscript/dispatchkit/boxed_numeric.hpp b/include/chaiscript/dispatchkit/boxed_numeric.hpp index 1e23005..93bd8a2 100644 --- a/include/chaiscript/dispatchkit/boxed_numeric.hpp +++ b/include/chaiscript/dispatchkit/boxed_numeric.hpp @@ -39,324 +39,308 @@ namespace chaiscript typedef typename choose_const::type type; }; - struct equals + struct boolean { + enum oper + { + equals, + less_than, + greater_than, + less_than_equal, + greater_than_equal, + not_equal + }; + + oper m_oper; + + boolean(boolean::oper t_oper) + : m_oper(t_oper) + { + } + static const bool lhs_const = true; + #pragma GCC diagnostic ignored "-Wsign-compare" template - static bool go(const T &t, const U &u) { return t == u; } + bool go(const T &t, const U &u) const + { + switch (m_oper) + { + case equals: + return t == u; + case less_than: + return t < u; + case greater_than: + return t > u; + case less_than_equal: + return t <= u; + case greater_than_equal: + return t >= u; + case not_equal: + return t != u; + } + throw boost::bad_any_cast(); + } }; - struct less_than + struct binary { - static const bool lhs_const = true; -#pragma GCC diagnostic ignored "-Wsign-compare" - template - static bool go(const T &t, const U &u) { return t < u; } - }; + enum oper + { + assign, + pre_increment, + pre_decrement, + assign_product, + assign_sum, + assign_quotient, + assign_difference, + }; - struct greater_than - { - static const bool lhs_const = true; -#pragma GCC diagnostic ignored "-Wsign-compare" - template - static bool go(const T &t, const U &u) { return t > u; } - }; + oper m_oper; - struct greater_than_equal - { - static const bool lhs_const = true; -#pragma GCC diagnostic ignored "-Wsign-compare" - template - static bool go(const T &t, const U &u) { return t >= u; } - }; + binary(binary::oper t_oper) + : m_oper(t_oper) + { + } - struct less_than_equal - { - static const bool lhs_const = true; -#pragma GCC diagnostic ignored "-Wsign-compare" - template - static bool go(const T &t, const U &u) { return t <= u; } - }; - - struct not_equal - { - static const bool lhs_const = true; -#pragma GCC diagnostic ignored "-Wsign-compare" - template - static bool go(const T &t, const U &u) { return t != u; } - }; - - struct add - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t + u); } - }; - - struct subtract - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t - u); } - }; - - struct multiply - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t * u); } - }; - - struct divide - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t / u); } - }; - - struct assign_product - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t *= u)); } - }; - - struct assign_quotient - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t /= u)); } - }; - - struct assign_sum - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t += u)); } - }; - - struct assign - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t.get() = u.get())); } - }; - - struct assign_difference - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t -= u)); } - }; - - struct assign_bitwise_and - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t &= u)); } - }; - - struct assign_bitwise_or - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t |= u)); } - }; - - struct assign_bitwise_xor - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t ^= u)); } - }; - - struct assign_remainder - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t %= u)); } - }; - - struct assign_bitshift_left - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t <<= u)); } - }; - - struct assign_bitshift_right - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U &u) { return var(&(t >>= u)); } - }; - - - struct pre_increment - { - static const bool lhs_const = false; - template - static Boxed_Value go(T &t, const U) { return var(&++t); } - }; - - struct unary_plus - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U) { return const_var(+t); } - }; - - struct bitwise_complement - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U) { return const_var(~t); } - }; - - struct unary_minus - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U) { return const_var(-t); } - }; - - struct bitwise_and - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t & u); } - }; - - struct bitwise_xor - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t ^ u); } - }; - - struct bitwise_or - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t | u); } - }; - - struct remainder - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t % u); } - }; - - struct left_shift - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t << u); } - }; - - struct right_shift - { - static const bool lhs_const = true; - template - static Boxed_Value go(const T &t, const U &u) { return const_var(t >> u); } - }; - - struct pre_decrement - { static const bool lhs_const = false; - template - static Boxed_Value go(boost::reference_wrapper, const U) { std::cout<< "why where?"<< std::endl; throw boost::bad_any_cast(); } + template + Boxed_Value go(T &t, const U &u) const + { + switch (m_oper) + { + case assign: + return var(&(t.get() = u.get())); + case pre_increment: + return var(&(++t)); + case pre_decrement: + return var(&(--t)); + case assign_product: + return var(&(t *= u)); + case assign_sum: + return var(&(t += u)); + case assign_quotient: + return var(&(t /= u)); + case assign_difference: + return var(&(t -= u)); + } + throw boost::bad_any_cast(); + } + }; + + + struct binary_int + { + enum oper + { + assign_bitwise_and, + assign_bitwise_or, + assign_shift_left, + assign_shift_right, + assign_remainder, + assign_bitwise_xor, + }; + + oper m_oper; + + binary_int(binary_int::oper t_oper) + : m_oper(t_oper) + { + } + + static const bool lhs_const = false; template - static Boxed_Value go(T &t, const U) { return var(&--t); } + Boxed_Value go(T &t, const U &u) const + { + switch (m_oper) + { + case assign_bitwise_and: + return var(&(t &= u)); + case assign_bitwise_or: + return var(&(t |= u)); + case assign_shift_left: + return var(&(t <<= u)); + case assign_shift_right: + return var(&(t >>= u)); + case assign_remainder: + return var(&(t %= u)); + case assign_bitwise_xor: + return var(&(t ^= u)); + } + throw boost::bad_any_cast(); + } + }; + + struct const_binary_int + { + enum oper + { + shift_left, + shift_right, + remainder, + bitwise_and, + bitwise_or, + bitwise_xor, + bitwise_complement + }; + + oper m_oper; + + const_binary_int(const_binary_int::oper t_oper) + : m_oper(t_oper) + { + } + + static const bool lhs_const = true; + + template + Boxed_Value go(const T &t, const U &u) const + { + switch (m_oper) + { + case shift_left: + return const_var(t << u); + case shift_right: + return const_var(t >> u); + case remainder: + return const_var(t % u); + case bitwise_and: + return const_var(t & u); + case bitwise_or: + return const_var(t | u); + case bitwise_xor: + return const_var(t ^ u); + case bitwise_complement: + return const_var(~t); + } + throw boost::bad_any_cast(); + } + }; + + struct const_binary + { + enum oper + { + sum, + quotient, + product, + difference, + unary_plus, + unary_minus + }; + + oper m_oper; + + const_binary(const_binary::oper t_oper) + : m_oper(t_oper) + { + } + + static const bool lhs_const = true; + + template + Boxed_Value go(const T &t, const U &u) const + { + switch (m_oper) + { + case sum: + return const_var(t + u); + case quotient: + return const_var(t / u); + case product: + return const_var(t * u); + case difference: + return const_var(t - u); + case unary_minus: + return const_var(-t); + case unary_plus: + return const_var(+t); + } + throw boost::bad_any_cast(); + } }; template - static Ret oper_lhs(L l, const Boxed_Numeric &r) + static Ret oper_lhs(const O &t_o, L l, const Boxed_Numeric &r) { const Type_Info &inp_ = r.bv.get_type_info(); if (inp_ == typeid(double)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(float)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(long double)) { - return O::go(l, boxed_cast(r.bv)); - } else if (inp_ == typeid(bool)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(char)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(unsigned int)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(long)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(unsigned long)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::int8_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::int16_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::int32_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::int64_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::uint8_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::uint16_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::uint32_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::uint64_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else { throw boost::bad_any_cast(); } } template - static Ret oper(const Boxed_Numeric &l, const Boxed_Numeric &r) + static Ret oper(const O& t_o, const Boxed_Numeric &l, const Boxed_Numeric &r) { const Type_Info &inp_ = l.bv.get_type_info(); if (inp_ == typeid(double)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(long double)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(float)) { - return oper_lhs(boxed_cast::type>(l.bv), r); - } else if (inp_ == typeid(bool)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(char)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(int)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(unsigned int)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(long)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(unsigned long)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::int8_t)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::int16_t)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::int32_t)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::int64_t)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::uint8_t)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::uint16_t)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::uint32_t)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::uint64_t)) { - return oper_lhs(boxed_cast::type>(l.bv), r); + return oper_lhs(t_o, boxed_cast::type>(l.bv), r); } else { throw boost::bad_any_cast(); } @@ -364,74 +348,70 @@ namespace chaiscript template - static Ret oper_int_lhs(L l, const Boxed_Numeric &r) + static Ret oper_int_lhs(const O &t_o, L l, const Boxed_Numeric &r) { const Type_Info &inp_ = r.bv.get_type_info(); - if (inp_ == typeid(bool)) { - return O::go(l, boxed_cast(r.bv)); - } else if (inp_ == typeid(char)) { - return O::go(l, boxed_cast(r.bv)); + if (inp_ == typeid(char)) { + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(unsigned int)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(long)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(unsigned long)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::int8_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::int16_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::int32_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::int64_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::uint8_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::uint16_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::uint32_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else if (inp_ == typeid(boost::uint64_t)) { - return O::go(l, boxed_cast(r.bv)); + return t_o.go(l, boxed_cast(r.bv)); } else { throw boost::bad_any_cast(); } } template - static Ret oper_int(const Boxed_Numeric &l, const Boxed_Numeric &r) + static Ret oper_int(const O &t_o, const Boxed_Numeric &l, const Boxed_Numeric &r) { const Type_Info &inp_ = l.bv.get_type_info(); - if (inp_ == typeid(bool)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); - } else if (inp_ == typeid(char)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + if (inp_ == typeid(char)) { + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(int)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(unsigned int)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(long)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(unsigned long)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::int8_t)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::int16_t)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::int32_t)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::int64_t)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::uint8_t)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::uint16_t)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::uint32_t)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else if (inp_ == typeid(boost::uint64_t)) { - return oper_int_lhs(boxed_cast::type>(l.bv), r); + return oper_int_lhs(t_o, boxed_cast::type>(l.bv), r); } else { throw boost::bad_any_cast(); } @@ -452,159 +432,159 @@ namespace chaiscript bool operator==(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(boolean(boolean::equals), *this, r); } bool operator<(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(boolean(boolean::less_than), *this, r); } bool operator>(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(boolean(boolean::greater_than), *this, r); } bool operator>=(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(boolean(boolean::greater_than_equal), *this, r); } bool operator<=(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(boolean(boolean::less_than_equal), *this, r); } bool operator!=(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(boolean(boolean::not_equal), *this, r); } Boxed_Value operator--() const { - return oper(*this, var(0)); + return oper(binary(binary::pre_decrement), *this, var(0)); } Boxed_Value operator++() const { - return oper(*this, var(0)); + return oper(binary(binary::pre_increment), *this, var(0)); } Boxed_Value operator+(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(const_binary(const_binary::sum), *this, r); } Boxed_Value operator+() const { - return oper(*this, Boxed_Value(0)); + return oper(const_binary(const_binary::unary_plus), *this, Boxed_Value(0)); } Boxed_Value operator-() const { - return oper(*this, Boxed_Value(0)); + return oper(const_binary(const_binary::unary_minus), *this, Boxed_Value(0)); } Boxed_Value operator-(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(const_binary(const_binary::difference), *this, r); } Boxed_Value operator&=(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(binary_int(binary_int::assign_bitwise_or), *this, r); } Boxed_Value operator=(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(binary(binary::assign), *this, r); } Boxed_Value operator|=(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(binary_int(binary_int::assign_bitwise_or), *this, r); } Boxed_Value operator^=(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(binary_int(binary_int::assign_bitwise_xor), *this, r); } Boxed_Value operator%=(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(binary_int(binary_int::assign_remainder), *this, r); } Boxed_Value operator<<=(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(binary_int(binary_int::assign_shift_left), *this, r); } Boxed_Value operator>>=(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(binary_int(binary_int::assign_shift_right), *this, r); } Boxed_Value operator&(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(const_binary_int(const_binary_int::bitwise_and), *this, r); } Boxed_Value operator~() const { - return oper_int(*this, Boxed_Value(0)); + return oper_int(const_binary_int(const_binary_int::bitwise_complement), *this, Boxed_Value(0)); } Boxed_Value operator^(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(const_binary_int(const_binary_int::bitwise_xor), *this, r); } Boxed_Value operator|(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(const_binary_int(const_binary_int::bitwise_or), *this, r); } Boxed_Value operator*=(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(binary(binary::assign_product), *this, r); } Boxed_Value operator/=(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(binary(binary::assign_quotient), *this, r); } Boxed_Value operator+=(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(binary(binary::assign_sum), *this, r); } Boxed_Value operator-=(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(binary(binary::assign_difference), *this, r); } Boxed_Value operator/(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(const_binary(const_binary::quotient), *this, r); } Boxed_Value operator<<(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(const_binary_int(const_binary_int::shift_left), *this, r); } Boxed_Value operator*(const Boxed_Numeric &r) const { - return oper(*this, r); + return oper(const_binary(const_binary::product), *this, r); } Boxed_Value operator%(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(const_binary_int(const_binary_int::remainder), *this, r); } Boxed_Value operator>>(const Boxed_Numeric &r) const { - return oper_int(*this, r); + return oper_int(const_binary_int(const_binary_int::shift_right), *this, r); } Boxed_Value bv;