From 946397e325b8571ac8d909f6a600dad3fcb62e5b Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 23 Jul 2018 18:55:18 +1000 Subject: [PATCH] debug: instantiate is_valid for numeric primitives --- debug.cpp | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/debug.cpp b/debug.cpp index a5511f1a..12cccaa9 100644 --- a/debug.cpp +++ b/debug.cpp @@ -11,12 +11,13 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2010-2016 Danny Robson + * Copyright 2010-2018 Danny Robson */ #include "backtrace.hpp" #include "debug.hpp" #include "log.hpp" +#include "preprocessor.hpp" #include #include @@ -110,3 +111,38 @@ util::debug::validator::is_valid (const float &val) noexcept { return !std::isnan (val); } + + +//----------------------------------------------------------------------------- +template <> +bool +util::debug::validator::is_valid (const double &val) noexcept +{ + return !std::isnan (val); +} + + +/////////////////////////////////////////////////////////////////////////////// +#include "std.hpp" + + +//----------------------------------------------------------------------------- +#define INSTANTIATE(KLASS) \ +template <> \ +struct util::debug::validator { \ + static bool is_valid(KLASS const&); \ +}; \ + \ +bool \ +util::debug::validator::is_valid(KLASS const&) \ +{ \ + return true; \ +} + + +//----------------------------------------------------------------------------- +MAP0(INSTANTIATE, + u08, u16, u32, u64, + i08, i16, i32, i64, + char +)