From d7f6787cd10c3c0ea9da094ff53acca4fd9bf4a9 Mon Sep 17 00:00:00 2001 From: neargye Date: Fri, 4 Oct 2019 13:57:06 +0500 Subject: [PATCH] add NAMEOF_ENUM_NO_CHECK_SUPPORT and NAMEOF_TYPE_NO_CHECK_SUPPORT --- doc/reference.md | 2 ++ include/nameof.hpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/reference.md b/doc/reference.md index 518959f..7f59a5a 100644 --- a/doc/reference.md +++ b/doc/reference.md @@ -21,8 +21,10 @@ * All functions `constexpr` and `noexcept`. * To check is nameof_type supported compiler use macro `NAMEOF_TYPE_SUPPORTED` or constexpr constant `nameof::is_nameof_type_supported`. +If nameof_type used on unsupported compiler, occurs the compilation error. To suppress error define macro `NAMEOF_TYPE_NO_CHECK_SUPPORT`. * To check is nameof_enum supported compiler use macro `NAMEOF_ENUM_SUPPORTED` or constexpr constant `nameof::is_nameof_enum_supported`. +If nameof_enum used on unsupported compiler, occurs the compilation error. To suppress error define macro `NAMEOF_ENUM_NO_CHECK_SUPPORT`. ## `NAMEOF` diff --git a/include/nameof.hpp b/include/nameof.hpp index 6c2d07e..a7a131b 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -212,7 +212,7 @@ struct identity final { template struct nameof_type_supported final -#if defined(NAMEOF_TYPE_SUPPORTED) && NAMEOF_TYPE_SUPPORTED +#if defined(NAMEOF_TYPE_SUPPORTED) && NAMEOF_TYPE_SUPPORTED || defined(NAMEOF_TYPE_NO_CHECK_SUPPORT) : std::true_type {}; #else : std::false_type {}; @@ -220,7 +220,7 @@ struct nameof_type_supported final template struct nameof_enum_supported final -#if defined(NAMEOF_ENUM_SUPPORTED) && NAMEOF_ENUM_SUPPORTED +#if defined(NAMEOF_ENUM_SUPPORTED) && NAMEOF_ENUM_SUPPORTED || defined(NAMEOF_ENUM_NO_CHECK_SUPPORT) : std::true_type {}; #else : std::false_type {};