From fb19bdec67b381eda56eefea35c4444afa346e8b Mon Sep 17 00:00:00 2001 From: rexy712 Date: Sun, 26 Jun 2022 11:55:56 -0700 Subject: [PATCH] Macro to check for c++20 support instead of long form writing --- include/rexy/compat/standard.hpp | 2 ++ include/rexy/format.hpp | 2 ++ include/rexy/format.tpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/include/rexy/compat/standard.hpp b/include/rexy/compat/standard.hpp index 9f994fe..28ecba5 100644 --- a/include/rexy/compat/standard.hpp +++ b/include/rexy/compat/standard.hpp @@ -19,6 +19,8 @@ #ifndef REXY_COMPAT_CPP20_HPP #define REXY_COMPAT_CPP20_HPP + #define REXY_REQUIRES_CPP20 static_assert(__cplusplus >= 202002L, "C++20 is required to use this file.") + #if __cplusplus >= 202002L #define REXY_CPP20_CONSTEXPR constexpr #define REXY_CPP20_CONSTEVAL consteval diff --git a/include/rexy/format.hpp b/include/rexy/format.hpp index a54deab..4eeb343 100644 --- a/include/rexy/format.hpp +++ b/include/rexy/format.hpp @@ -24,6 +24,8 @@ #include "compat/standard.hpp" +REXY_REQUIRES_CPP20; + #ifndef REXY_STANDARD_CPP20 //Maybe I'll make it work someday, but not for now #error "Cannot use formatting library without C++20 support" diff --git a/include/rexy/format.tpp b/include/rexy/format.tpp index f739fad..3033c81 100644 --- a/include/rexy/format.tpp +++ b/include/rexy/format.tpp @@ -19,6 +19,8 @@ #ifndef REXY_FORMAT_TPP #define REXY_FORMAT_TPP +REXY_REQUIRES_CPP20; + #include "detail/format/format_args.tpp" #include "detail/format/formatter.tpp" #include "detail/format/storage.tpp"