diff options
author | Abseil Team <absl-team@google.com> | 2024-07-03 22:07:51 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-07-03 22:08:39 -0700 |
commit | 074a32af66648c74dd0104e251e44ace5b59f7fa (patch) | |
tree | a7ffd02d87db9a565627000ac9afbb59fa32d974 /absl/base/config.h | |
parent | eb46a63d77d7d1c1d30e2c9243099f89c629003c (diff) |
Mark c_min_element, c_max_element, and c_minmax_element as constexpr in C++17.
This allows them to be used in constant expressions, such as static_asserts.
PiperOrigin-RevId: 649292841
Change-Id: I76e31a94b933fa357276fee534b81c00c28c8b23
Diffstat (limited to 'absl/base/config.h')
-rw-r--r-- | absl/base/config.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/absl/base/config.h b/absl/base/config.h index 13263f9d..97c9a22a 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -941,25 +941,25 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || #define ABSL_HAVE_CONSTANT_EVALUATED 1 #endif -// ABSL_CONSTEXPR_SINCE_CXXYY is used to conditionally define constexpr for -// different C++ versions. -#if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \ - ABSL_INTERNAL_CPLUSPLUS_LANG >= 201402L -#define ABSL_CONSTEXPR_SINCE_CXX14 constexpr -#else -#define ABSL_CONSTEXPR_SINCE_CXX14 -#endif +// ABSL_INTERNAL_CONSTEXPR_SINCE_CXXYY is used to conditionally define constexpr +// for different C++ versions. +// +// These macros are an implementation detail and will be unconditionally removed +// once the minimum supported C++ version catches up to a given version. +// +// For this reason, this symbol is considered INTERNAL and code outside of +// Abseil must not use it. #if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \ ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L -#define ABSL_CONSTEXPR_SINCE_CXX17 constexpr +#define ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17 constexpr #else -#define ABSL_CONSTEXPR_SINCE_CXX17 +#define ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17 #endif #if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \ ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L -#define ABSL_CONSTEXPR_SINCE_CXX20 constexpr +#define ABSL_INTERNAL_CONSTEXPR_SINCE_CXX20 constexpr #else -#define ABSL_CONSTEXPR_SINCE_CXX20 +#define ABSL_INTERNAL_CONSTEXPR_SINCE_CXX20 #endif // ABSL_INTERNAL_EMSCRIPTEN_VERSION combines Emscripten's three version macros |