From 437f6a03a9e2bc631228a1612ce9dbf3799550d6 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Mon, 14 May 2012 18:09:55 -0600 Subject: [PATCH] Slight cleanup of the boxed_number cleanups from mgee --- include/chaiscript/dispatchkit/boxed_number.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index 4814a705..4b81f4bb 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -303,8 +303,9 @@ namespace chaiscript } 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); } - 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(); if (inp_ == typeid(bool)) { @@ -387,7 +386,12 @@ namespace chaiscript { throw boost::bad_any_cast(); } + } + Boxed_Number operator=(const Boxed_Value &v) + { + validate_boxed_number(v); + bv = v; return *this; }