mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
Slight cleanup of the boxed_number cleanups from mgee
This commit is contained in:
parent
94fefa0690
commit
437f6a03a9
@ -303,8 +303,9 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Number(const Boxed_Value &v)
|
Boxed_Number(const Boxed_Value &v)
|
||||||
|
: bv(v)
|
||||||
{
|
{
|
||||||
operator=(v);
|
validate_boxed_number(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -373,10 +374,8 @@ 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)
|
void validate_boxed_number(const Boxed_Value &v)
|
||||||
{
|
{
|
||||||
bv = v;
|
|
||||||
|
|
||||||
const Type_Info &inp_ = v.get_type_info();
|
const Type_Info &inp_ = v.get_type_info();
|
||||||
if (inp_ == typeid(bool))
|
if (inp_ == typeid(bool))
|
||||||
{
|
{
|
||||||
@ -387,7 +386,12 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
throw boost::bad_any_cast();
|
throw boost::bad_any_cast();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Boxed_Number operator=(const Boxed_Value &v)
|
||||||
|
{
|
||||||
|
validate_boxed_number(v);
|
||||||
|
bv = v;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user