Wrap up new Boxed_Numeric support
This commit is contained in:

committed by
Jason Turner

parent
3b754cfec4
commit
92bfcfdcf3
@@ -429,6 +429,7 @@ namespace chaiscript
|
||||
|
||||
basic_constructors<bool>("bool", m);
|
||||
operators::assign<bool>(m);
|
||||
operators::equal<bool>(m);
|
||||
|
||||
m->add(fun(&to_string<const std::string &>), "internal_to_string");
|
||||
m->add(fun(&Bootstrap::bool_to_string), "internal_to_string");
|
||||
|
@@ -46,9 +46,9 @@ namespace chaiscript
|
||||
assign_shift_right,
|
||||
assign_remainder,
|
||||
assign_bitwise_xor,
|
||||
const_int_flag,
|
||||
shift_left,
|
||||
shift_right,
|
||||
const_int_flag,
|
||||
remainder,
|
||||
bitwise_and,
|
||||
bitwise_or,
|
||||
@@ -321,7 +321,7 @@ namespace chaiscript
|
||||
return oper_rhs<boost::uint32_t, false>(t_oper, t_lhs, t_rhs);
|
||||
} else if (inp_ == typeid(boost::uint64_t)) {
|
||||
return oper_rhs<boost::uint64_t, false>(t_oper, t_lhs, t_rhs);
|
||||
} else {
|
||||
} else {
|
||||
throw boost::bad_any_cast();
|
||||
}
|
||||
}
|
||||
@@ -333,6 +333,10 @@ namespace chaiscript
|
||||
: bv(v)
|
||||
{
|
||||
const Type_Info &inp_ = v.get_type_info();
|
||||
if (inp_ == typeid(bool))
|
||||
{
|
||||
throw boost::bad_any_cast();
|
||||
}
|
||||
|
||||
if (!inp_.is_arithmetic())
|
||||
{
|
||||
|
@@ -301,7 +301,9 @@ int main()
|
||||
passed &= built_in_type_test<int>(5, true);
|
||||
passed &= built_in_type_test<double>(1.1, true);
|
||||
passed &= built_in_type_test<char>('a', true);
|
||||
passed &= built_in_type_test<bool>(false, true);
|
||||
passed &= built_in_type_test<uint8_t>('a', true);
|
||||
passed &= built_in_type_test<int64_t>('a', true);
|
||||
passed &= built_in_type_test<bool>(false, false);
|
||||
passed &= built_in_type_test<std::string>("Hello World", false);
|
||||
|
||||
// storing a pointer
|
||||
|
Reference in New Issue
Block a user