mirror of
https://github.com/electronicarts/EABase.git
synced 2026-01-18 17:11:23 +01:00
Add EA_CPP20_CONSTEXPR and EA_COMPILER_CPP20_ENABLED
This commit is contained in:
@@ -313,12 +313,11 @@
|
||||
// decided to not define __cplusplus like thus until they have fully completed their
|
||||
// C++20 support.
|
||||
#if !defined(EA_COMPILER_CPP20_ENABLED) && defined(__cplusplus)
|
||||
// TODO(rparoin): enable once a C++20 value for the __cplusplus macro has been published
|
||||
// #if (__cplusplus >= 202003L)
|
||||
// #define EA_COMPILER_CPP20_ENABLED 1
|
||||
// #elif defined(_MSVC_LANG) && (_MSVC_LANG >= 202003L) // C++20+
|
||||
// #define EA_COMPILER_CPP20_ENABLED 1
|
||||
// #endif
|
||||
#if defined(__cplusplus) && (__cplusplus >= 202002L)
|
||||
#define EA_COMPILER_CPP20_ENABLED 1
|
||||
#elif defined(_MSVC_LANG) && (_MSVC_LANG >= 202002L)
|
||||
#define EA_COMPILER_CPP20_ENABLED 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -2023,6 +2023,23 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// EA_CPP20_CONSTEXPR
|
||||
//
|
||||
// Defined as constexpr when the targeted language version is higher than or equal to
|
||||
// C++20. Defined as nothing otherwise.
|
||||
//
|
||||
#if !defined(EA_CPP20_CONSTEXPR)
|
||||
#if defined(EA_COMPILER_CPP20_ENABLED)
|
||||
#define EA_CPP20_CONSTEXPR constexpr
|
||||
#else
|
||||
#define EA_CPP20_CONSTEXPR
|
||||
#define EA_NO_CPP20_CONSTEXPR 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// EA_CONSTEXPR_IF
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user