Macro to check for c++20 support instead of long form writing

This commit is contained in:
rexy712 2022-06-26 11:55:56 -07:00
parent 7f47a4cbf8
commit fb19bdec67
3 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,8 @@
#ifndef REXY_COMPAT_CPP20_HPP #ifndef REXY_COMPAT_CPP20_HPP
#define 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 #if __cplusplus >= 202002L
#define REXY_CPP20_CONSTEXPR constexpr #define REXY_CPP20_CONSTEXPR constexpr
#define REXY_CPP20_CONSTEVAL consteval #define REXY_CPP20_CONSTEVAL consteval

View File

@ -24,6 +24,8 @@
#include "compat/standard.hpp" #include "compat/standard.hpp"
REXY_REQUIRES_CPP20;
#ifndef REXY_STANDARD_CPP20 #ifndef REXY_STANDARD_CPP20
//Maybe I'll make it work someday, but not for now //Maybe I'll make it work someday, but not for now
#error "Cannot use formatting library without C++20 support" #error "Cannot use formatting library without C++20 support"

View File

@ -19,6 +19,8 @@
#ifndef REXY_FORMAT_TPP #ifndef REXY_FORMAT_TPP
#define REXY_FORMAT_TPP #define REXY_FORMAT_TPP
REXY_REQUIRES_CPP20;
#include "detail/format/format_args.tpp" #include "detail/format/format_args.tpp"
#include "detail/format/formatter.tpp" #include "detail/format/formatter.tpp"
#include "detail/format/storage.tpp" #include "detail/format/storage.tpp"