Merge 59dfc847aee0892bceb522f1eaec2b753d9859f3 into b0b1549503e0f0d3a7e73fbf6e982dcf4a2d9fb7

This commit is contained in:
GitHub Merge Button 2012-05-14 12:34:41 -07:00
commit 8f53c0c171

View File

@ -297,19 +297,14 @@ namespace chaiscript
public: public:
Boxed_Number(const Boxed_Value &v) Boxed_Number()
: bv(v) : bv(Boxed_Value(0))
{ {
const Type_Info &inp_ = v.get_type_info(); }
if (inp_ == typeid(bool))
{
throw boost::bad_any_cast();
}
if (!inp_.is_arithmetic()) Boxed_Number(const Boxed_Value &v)
{ {
throw boost::bad_any_cast(); operator=(v);
}
} }
@ -378,6 +373,24 @@ namespace chaiscript
return oper(Operators::assign_bitwise_and, this->bv, t_rhs.bv); 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 Boxed_Number operator=(const Boxed_Number &t_rhs) const
{ {
return oper(Operators::assign, this->bv, t_rhs.bv); return oper(Operators::assign, this->bv, t_rhs.bv);