Significant reduction in templates instantiated by grouping of operators - smaller code and compile time
This commit is contained in:
@@ -39,324 +39,308 @@ namespace chaiscript
|
|||||||
typedef typename choose_const<T, O::lhs_const>::type type;
|
typedef typename choose_const<T, O::lhs_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;
|
static const bool lhs_const = true;
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
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;
|
enum oper
|
||||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
{
|
||||||
template<typename T, typename U>
|
assign,
|
||||||
static bool go(const T &t, const U &u) { return t < u; }
|
pre_increment,
|
||||||
};
|
pre_decrement,
|
||||||
|
assign_product,
|
||||||
|
assign_sum,
|
||||||
|
assign_quotient,
|
||||||
|
assign_difference,
|
||||||
|
};
|
||||||
|
|
||||||
struct greater_than
|
oper m_oper;
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
|
||||||
template<typename T, typename U>
|
|
||||||
static bool go(const T &t, const U &u) { return t > u; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct greater_than_equal
|
binary(binary::oper t_oper)
|
||||||
{
|
: m_oper(t_oper)
|
||||||
static const bool lhs_const = true;
|
{
|
||||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
}
|
||||||
template<typename T, typename U>
|
|
||||||
static bool go(const T &t, const U &u) { return t >= u; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct less_than_equal
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
|
||||||
template<typename T, typename U>
|
|
||||||
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<typename T, typename U>
|
|
||||||
static bool go(const T &t, const U &u) { return t != u; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct add
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(const T &t, const U &u) { return const_var(t + u); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct subtract
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(const T &t, const U &u) { return const_var(t - u); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct multiply
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(const T &t, const U &u) { return const_var(t * u); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct divide
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
template<typename T, typename U>
|
|
||||||
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<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t *= u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct assign_quotient
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t /= u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct assign_sum
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t += u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct assign
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
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<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t -= u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct assign_bitwise_and
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t &= u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct assign_bitwise_or
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t |= u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct assign_bitwise_xor
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t ^= u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct assign_remainder
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t %= u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct assign_bitshift_left
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t <<= u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct assign_bitshift_right
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U &u) { return var(&(t >>= u)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct pre_increment
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(T &t, const U) { return var(&++t); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct unary_plus
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(const T &t, const U) { return const_var(+t); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct bitwise_complement
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(const T &t, const U) { return const_var(~t); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct unary_minus
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
template<typename T, typename U>
|
|
||||||
static Boxed_Value go(const T &t, const U) { return const_var(-t); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct bitwise_and
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
template<typename T, typename U>
|
|
||||||
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<typename T, typename U>
|
|
||||||
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<typename T, typename U>
|
|
||||||
static Boxed_Value go(const T &t, const U &u) { return const_var(t | u); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct remainder
|
|
||||||
{
|
|
||||||
static const bool lhs_const = true;
|
|
||||||
template<typename T, typename U>
|
|
||||||
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<typename T, typename U>
|
|
||||||
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<typename T, typename U>
|
|
||||||
static Boxed_Value go(const T &t, const U &u) { return const_var(t >> u); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct pre_decrement
|
|
||||||
{
|
|
||||||
static const bool lhs_const = false;
|
static const bool lhs_const = false;
|
||||||
|
|
||||||
template<typename U>
|
template<typename T, typename U>
|
||||||
static Boxed_Value go(boost::reference_wrapper<bool>, const U) { std::cout<< "why where?"<< std::endl; throw boost::bad_any_cast(); }
|
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<typename T, typename U>
|
template<typename T, typename U>
|
||||||
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<typename T, typename U>
|
||||||
|
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<typename T, typename U>
|
||||||
|
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<typename Ret, typename O, typename L>
|
template<typename Ret, typename O, typename L>
|
||||||
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();
|
const Type_Info &inp_ = r.bv.get_type_info();
|
||||||
|
|
||||||
if (inp_ == typeid(double))
|
if (inp_ == typeid(double))
|
||||||
{
|
{
|
||||||
return O::go(l, boxed_cast<const double &>(r.bv));
|
return t_o.go(l, boxed_cast<const double &>(r.bv));
|
||||||
} else if (inp_ == typeid(float)) {
|
} else if (inp_ == typeid(float)) {
|
||||||
return O::go(l, boxed_cast<const float&>(r.bv));
|
return t_o.go(l, boxed_cast<const float&>(r.bv));
|
||||||
} else if (inp_ == typeid(long double)) {
|
} else if (inp_ == typeid(long double)) {
|
||||||
return O::go(l, boxed_cast<const long double&>(r.bv));
|
return t_o.go(l, boxed_cast<const long double&>(r.bv));
|
||||||
} else if (inp_ == typeid(bool)) {
|
|
||||||
return O::go(l, boxed_cast<const bool&>(r.bv));
|
|
||||||
} else if (inp_ == typeid(char)) {
|
} else if (inp_ == typeid(char)) {
|
||||||
return O::go(l, boxed_cast<const char&>(r.bv));
|
return t_o.go(l, boxed_cast<const char&>(r.bv));
|
||||||
} else if (inp_ == typeid(unsigned int)) {
|
} else if (inp_ == typeid(unsigned int)) {
|
||||||
return O::go(l, boxed_cast<const unsigned int&>(r.bv));
|
return t_o.go(l, boxed_cast<const unsigned int&>(r.bv));
|
||||||
} else if (inp_ == typeid(long)) {
|
} else if (inp_ == typeid(long)) {
|
||||||
return O::go(l, boxed_cast<const long&>(r.bv));
|
return t_o.go(l, boxed_cast<const long&>(r.bv));
|
||||||
} else if (inp_ == typeid(unsigned long)) {
|
} else if (inp_ == typeid(unsigned long)) {
|
||||||
return O::go(l, boxed_cast<const unsigned long&>(r.bv));
|
return t_o.go(l, boxed_cast<const unsigned long&>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::int8_t)) {
|
} else if (inp_ == typeid(boost::int8_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::int8_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::int8_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::int16_t)) {
|
} else if (inp_ == typeid(boost::int16_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::int16_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::int16_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::int32_t)) {
|
} else if (inp_ == typeid(boost::int32_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::int32_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::int32_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::int64_t)) {
|
} else if (inp_ == typeid(boost::int64_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::int64_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::int64_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::uint8_t)) {
|
} else if (inp_ == typeid(boost::uint8_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::uint8_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::uint8_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::uint16_t)) {
|
} else if (inp_ == typeid(boost::uint16_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::uint16_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::uint16_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::uint32_t)) {
|
} else if (inp_ == typeid(boost::uint32_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::uint32_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::uint32_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::uint64_t)) {
|
} else if (inp_ == typeid(boost::uint64_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::uint64_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::uint64_t &>(r.bv));
|
||||||
} else {
|
} else {
|
||||||
throw boost::bad_any_cast();
|
throw boost::bad_any_cast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Ret, typename O>
|
template<typename Ret, typename O>
|
||||||
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();
|
const Type_Info &inp_ = l.bv.get_type_info();
|
||||||
|
|
||||||
if (inp_ == typeid(double))
|
if (inp_ == typeid(double))
|
||||||
{
|
{
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, double>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, double>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(long double)) {
|
} else if (inp_ == typeid(long double)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, long double>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, long double>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(float)) {
|
} else if (inp_ == typeid(float)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, float>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, float>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(bool)) {
|
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, bool>::type>(l.bv), r);
|
|
||||||
} else if (inp_ == typeid(char)) {
|
} else if (inp_ == typeid(char)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, char>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, char>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(int)) {
|
} else if (inp_ == typeid(int)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, int>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, int>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(unsigned int)) {
|
} else if (inp_ == typeid(unsigned int)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, unsigned int>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, unsigned int>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(long)) {
|
} else if (inp_ == typeid(long)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, long>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, long>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(unsigned long)) {
|
} else if (inp_ == typeid(unsigned long)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, unsigned long>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, unsigned long>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::int8_t)) {
|
} else if (inp_ == typeid(boost::int8_t)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::int8_t>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::int8_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::int16_t)) {
|
} else if (inp_ == typeid(boost::int16_t)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::int32_t>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::int32_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::int32_t)) {
|
} else if (inp_ == typeid(boost::int32_t)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::int32_t>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::int32_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::int64_t)) {
|
} else if (inp_ == typeid(boost::int64_t)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::int64_t>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::int64_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::uint8_t)) {
|
} else if (inp_ == typeid(boost::uint8_t)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::uint8_t>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::uint8_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::uint16_t)) {
|
} else if (inp_ == typeid(boost::uint16_t)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::uint16_t>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::uint16_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::uint32_t)) {
|
} else if (inp_ == typeid(boost::uint32_t)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::uint32_t>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::uint32_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::uint64_t)) {
|
} else if (inp_ == typeid(boost::uint64_t)) {
|
||||||
return oper_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::uint64_t>::type>(l.bv), r);
|
return oper_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::uint64_t>::type>(l.bv), r);
|
||||||
} else {
|
} else {
|
||||||
throw boost::bad_any_cast();
|
throw boost::bad_any_cast();
|
||||||
}
|
}
|
||||||
@@ -364,74 +348,70 @@ namespace chaiscript
|
|||||||
|
|
||||||
|
|
||||||
template<typename Ret, typename O, typename L>
|
template<typename Ret, typename O, typename L>
|
||||||
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();
|
const Type_Info &inp_ = r.bv.get_type_info();
|
||||||
|
|
||||||
if (inp_ == typeid(bool)) {
|
if (inp_ == typeid(char)) {
|
||||||
return O::go(l, boxed_cast<const bool&>(r.bv));
|
return t_o.go(l, boxed_cast<const char&>(r.bv));
|
||||||
} else if (inp_ == typeid(char)) {
|
|
||||||
return O::go(l, boxed_cast<const char&>(r.bv));
|
|
||||||
} else if (inp_ == typeid(unsigned int)) {
|
} else if (inp_ == typeid(unsigned int)) {
|
||||||
return O::go(l, boxed_cast<const unsigned int&>(r.bv));
|
return t_o.go(l, boxed_cast<const unsigned int&>(r.bv));
|
||||||
} else if (inp_ == typeid(long)) {
|
} else if (inp_ == typeid(long)) {
|
||||||
return O::go(l, boxed_cast<const long&>(r.bv));
|
return t_o.go(l, boxed_cast<const long&>(r.bv));
|
||||||
} else if (inp_ == typeid(unsigned long)) {
|
} else if (inp_ == typeid(unsigned long)) {
|
||||||
return O::go(l, boxed_cast<const unsigned long&>(r.bv));
|
return t_o.go(l, boxed_cast<const unsigned long&>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::int8_t)) {
|
} else if (inp_ == typeid(boost::int8_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::int8_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::int8_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::int16_t)) {
|
} else if (inp_ == typeid(boost::int16_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::int16_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::int16_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::int32_t)) {
|
} else if (inp_ == typeid(boost::int32_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::int32_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::int32_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::int64_t)) {
|
} else if (inp_ == typeid(boost::int64_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::int64_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::int64_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::uint8_t)) {
|
} else if (inp_ == typeid(boost::uint8_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::uint8_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::uint8_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::uint16_t)) {
|
} else if (inp_ == typeid(boost::uint16_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::uint16_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::uint16_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::uint32_t)) {
|
} else if (inp_ == typeid(boost::uint32_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::uint32_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::uint32_t &>(r.bv));
|
||||||
} else if (inp_ == typeid(boost::uint64_t)) {
|
} else if (inp_ == typeid(boost::uint64_t)) {
|
||||||
return O::go(l, boxed_cast<const boost::uint64_t &>(r.bv));
|
return t_o.go(l, boxed_cast<const boost::uint64_t &>(r.bv));
|
||||||
} else {
|
} else {
|
||||||
throw boost::bad_any_cast();
|
throw boost::bad_any_cast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Ret, typename O>
|
template<typename Ret, typename O>
|
||||||
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();
|
const Type_Info &inp_ = l.bv.get_type_info();
|
||||||
|
|
||||||
if (inp_ == typeid(bool)) {
|
if (inp_ == typeid(char)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, bool>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, char>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(char)) {
|
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, char>::type>(l.bv), r);
|
|
||||||
} else if (inp_ == typeid(int)) {
|
} else if (inp_ == typeid(int)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, int>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, int>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(unsigned int)) {
|
} else if (inp_ == typeid(unsigned int)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, unsigned int>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, unsigned int>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(long)) {
|
} else if (inp_ == typeid(long)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, long>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, long>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(unsigned long)) {
|
} else if (inp_ == typeid(unsigned long)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, unsigned long>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, unsigned long>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::int8_t)) {
|
} else if (inp_ == typeid(boost::int8_t)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::int8_t>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::int8_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::int16_t)) {
|
} else if (inp_ == typeid(boost::int16_t)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::int32_t>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::int32_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::int32_t)) {
|
} else if (inp_ == typeid(boost::int32_t)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::int32_t>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::int32_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::int64_t)) {
|
} else if (inp_ == typeid(boost::int64_t)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::int64_t>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::int64_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::uint8_t)) {
|
} else if (inp_ == typeid(boost::uint8_t)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::uint8_t>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::uint8_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::uint16_t)) {
|
} else if (inp_ == typeid(boost::uint16_t)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::uint16_t>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::uint16_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::uint32_t)) {
|
} else if (inp_ == typeid(boost::uint32_t)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::uint32_t>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::uint32_t>::type>(l.bv), r);
|
||||||
} else if (inp_ == typeid(boost::uint64_t)) {
|
} else if (inp_ == typeid(boost::uint64_t)) {
|
||||||
return oper_int_lhs<Ret, O>(boxed_cast<typename lhs_type<O, boost::uint64_t>::type>(l.bv), r);
|
return oper_int_lhs<Ret>(t_o, boxed_cast<typename lhs_type<O, boost::uint64_t>::type>(l.bv), r);
|
||||||
} else {
|
} else {
|
||||||
throw boost::bad_any_cast();
|
throw boost::bad_any_cast();
|
||||||
}
|
}
|
||||||
@@ -452,159 +432,159 @@ namespace chaiscript
|
|||||||
|
|
||||||
bool operator==(const Boxed_Numeric &r) const
|
bool operator==(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<bool, equals>(*this, r);
|
return oper<bool>(boolean(boolean::equals), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(const Boxed_Numeric &r) const
|
bool operator<(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<bool, less_than>(*this, r);
|
return oper<bool>(boolean(boolean::less_than), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator>(const Boxed_Numeric &r) const
|
bool operator>(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<bool, greater_than>(*this, r);
|
return oper<bool>(boolean(boolean::greater_than), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator>=(const Boxed_Numeric &r) const
|
bool operator>=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<bool, greater_than_equal>(*this, r);
|
return oper<bool>(boolean(boolean::greater_than_equal), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<=(const Boxed_Numeric &r) const
|
bool operator<=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<bool, less_than_equal>(*this, r);
|
return oper<bool>(boolean(boolean::less_than_equal), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Boxed_Numeric &r) const
|
bool operator!=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<bool, not_equal>(*this, r);
|
return oper<bool>(boolean(boolean::not_equal), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator--() const
|
Boxed_Value operator--() const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, pre_decrement>(*this, var(0));
|
return oper<Boxed_Value>(binary(binary::pre_decrement), *this, var(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator++() const
|
Boxed_Value operator++() const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, pre_increment>(*this, var(0));
|
return oper<Boxed_Value>(binary(binary::pre_increment), *this, var(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator+(const Boxed_Numeric &r) const
|
Boxed_Value operator+(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, add>(*this, r);
|
return oper<Boxed_Value>(const_binary(const_binary::sum), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator+() const
|
Boxed_Value operator+() const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, unary_plus>(*this, Boxed_Value(0));
|
return oper<Boxed_Value>(const_binary(const_binary::unary_plus), *this, Boxed_Value(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator-() const
|
Boxed_Value operator-() const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, unary_minus>(*this, Boxed_Value(0));
|
return oper<Boxed_Value>(const_binary(const_binary::unary_minus), *this, Boxed_Value(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator-(const Boxed_Numeric &r) const
|
Boxed_Value operator-(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, subtract>(*this, r);
|
return oper<Boxed_Value>(const_binary(const_binary::difference), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator&=(const Boxed_Numeric &r) const
|
Boxed_Value operator&=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, assign_bitwise_and>(*this, r);
|
return oper_int<Boxed_Value>(binary_int(binary_int::assign_bitwise_or), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator=(const Boxed_Numeric &r) const
|
Boxed_Value operator=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, assign>(*this, r);
|
return oper<Boxed_Value>(binary(binary::assign), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator|=(const Boxed_Numeric &r) const
|
Boxed_Value operator|=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, assign_bitwise_or>(*this, r);
|
return oper_int<Boxed_Value>(binary_int(binary_int::assign_bitwise_or), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator^=(const Boxed_Numeric &r) const
|
Boxed_Value operator^=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, assign_bitwise_xor>(*this, r);
|
return oper_int<Boxed_Value>(binary_int(binary_int::assign_bitwise_xor), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator%=(const Boxed_Numeric &r) const
|
Boxed_Value operator%=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, assign_remainder>(*this, r);
|
return oper_int<Boxed_Value>(binary_int(binary_int::assign_remainder), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator<<=(const Boxed_Numeric &r) const
|
Boxed_Value operator<<=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, assign_bitshift_left>(*this, r);
|
return oper_int<Boxed_Value>(binary_int(binary_int::assign_shift_left), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator>>=(const Boxed_Numeric &r) const
|
Boxed_Value operator>>=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, assign_bitshift_right>(*this, r);
|
return oper_int<Boxed_Value>(binary_int(binary_int::assign_shift_right), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator&(const Boxed_Numeric &r) const
|
Boxed_Value operator&(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, bitwise_and>(*this, r);
|
return oper_int<Boxed_Value>(const_binary_int(const_binary_int::bitwise_and), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator~() const
|
Boxed_Value operator~() const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, bitwise_complement>(*this, Boxed_Value(0));
|
return oper_int<Boxed_Value>(const_binary_int(const_binary_int::bitwise_complement), *this, Boxed_Value(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator^(const Boxed_Numeric &r) const
|
Boxed_Value operator^(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, bitwise_xor>(*this, r);
|
return oper_int<Boxed_Value>(const_binary_int(const_binary_int::bitwise_xor), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator|(const Boxed_Numeric &r) const
|
Boxed_Value operator|(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, bitwise_or>(*this, r);
|
return oper_int<Boxed_Value>(const_binary_int(const_binary_int::bitwise_or), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator*=(const Boxed_Numeric &r) const
|
Boxed_Value operator*=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, assign_product>(*this, r);
|
return oper<Boxed_Value>(binary(binary::assign_product), *this, r);
|
||||||
}
|
}
|
||||||
Boxed_Value operator/=(const Boxed_Numeric &r) const
|
Boxed_Value operator/=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, assign_quotient>(*this, r);
|
return oper<Boxed_Value>(binary(binary::assign_quotient), *this, r);
|
||||||
}
|
}
|
||||||
Boxed_Value operator+=(const Boxed_Numeric &r) const
|
Boxed_Value operator+=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, assign_sum>(*this, r);
|
return oper<Boxed_Value>(binary(binary::assign_sum), *this, r);
|
||||||
}
|
}
|
||||||
Boxed_Value operator-=(const Boxed_Numeric &r) const
|
Boxed_Value operator-=(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, assign_difference>(*this, r);
|
return oper<Boxed_Value>(binary(binary::assign_difference), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator/(const Boxed_Numeric &r) const
|
Boxed_Value operator/(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, divide>(*this, r);
|
return oper<Boxed_Value>(const_binary(const_binary::quotient), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator<<(const Boxed_Numeric &r) const
|
Boxed_Value operator<<(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, left_shift>(*this, r);
|
return oper_int<Boxed_Value>(const_binary_int(const_binary_int::shift_left), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator*(const Boxed_Numeric &r) const
|
Boxed_Value operator*(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper<Boxed_Value, multiply>(*this, r);
|
return oper<Boxed_Value>(const_binary(const_binary::product), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator%(const Boxed_Numeric &r) const
|
Boxed_Value operator%(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, remainder>(*this, r);
|
return oper_int<Boxed_Value>(const_binary_int(const_binary_int::remainder), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value operator>>(const Boxed_Numeric &r) const
|
Boxed_Value operator>>(const Boxed_Numeric &r) const
|
||||||
{
|
{
|
||||||
return oper_int<Boxed_Value, right_shift>(*this, r);
|
return oper_int<Boxed_Value>(const_binary_int(const_binary_int::shift_right), *this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value bv;
|
Boxed_Value bv;
|
||||||
|
Reference in New Issue
Block a user