debug: instantiate is_valid for numeric primitives

This commit is contained in:
Danny Robson 2018-07-23 18:55:18 +10:00
parent 9f4fab6e3b
commit 946397e325

View File

@ -11,12 +11,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright 2010-2016 Danny Robson <danny@nerdcruft.net>
* Copyright 2010-2018 Danny Robson <danny@nerdcruft.net>
*/
#include "backtrace.hpp"
#include "debug.hpp"
#include "log.hpp"
#include "preprocessor.hpp"
#include <cstdlib>
#include <iostream>
@ -110,3 +111,38 @@ util::debug::validator<float>::is_valid (const float &val) noexcept
{
return !std::isnan (val);
}
//-----------------------------------------------------------------------------
template <>
bool
util::debug::validator<double>::is_valid (const double &val) noexcept
{
return !std::isnan (val);
}
///////////////////////////////////////////////////////////////////////////////
#include "std.hpp"
//-----------------------------------------------------------------------------
#define INSTANTIATE(KLASS) \
template <> \
struct util::debug::validator<KLASS> { \
static bool is_valid(KLASS const&); \
}; \
\
bool \
util::debug::validator<KLASS>::is_valid(KLASS const&) \
{ \
return true; \
}
//-----------------------------------------------------------------------------
MAP0(INSTANTIATE,
u08, u16, u32, u64,
i08, i16, i32, i64,
char
)