Make Boxed_Number assignable from Boxed_Value.

This commit is contained in:
Markus Groß
2012-05-14 21:34:28 +02:00
parent cdfefed385
commit 59dfc847ae

View File

@@ -303,18 +303,8 @@ namespace chaiscript
}
Boxed_Number(const Boxed_Value &v)
: bv(v)
{
const Type_Info &inp_ = v.get_type_info();
if (inp_ == typeid(bool))
{
throw boost::bad_any_cast();
}
if (!inp_.is_arithmetic())
{
throw boost::bad_any_cast();
}
operator=(v);
}
@@ -383,6 +373,24 @@ namespace chaiscript
return oper(Operators::assign_bitwise_and, this->bv, t_rhs.bv);
}
Boxed_Number operator=(const Boxed_Value &v)
{
bv = v;
const Type_Info &inp_ = v.get_type_info();
if (inp_ == typeid(bool))
{
throw boost::bad_any_cast();
}
if (!inp_.is_arithmetic())
{
throw boost::bad_any_cast();
}
return *this;
}
Boxed_Number operator=(const Boxed_Number &t_rhs) const
{
return oper(Operators::assign, this->bv, t_rhs.bv);