From c572855b95069a5a11184dd1ce862ba8499c5be2 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Fri, 30 Jun 2023 11:18:53 +0200 Subject: [PATCH] Utils: Use _cpp_lib_constexpr_string to test for constexpr std::string Seems not all compiler already implemented constexpr std::string. Change-Id: I588ef56767125a38fd80d0798ea954c11c8f6237 Reviewed-by: Qt CI Patch Build Bot Reviewed-by: hjk --- src/libs/utils/smallstringview.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/smallstringview.h b/src/libs/utils/smallstringview.h index fd7f1edfd24..982192c7a44 100644 --- a/src/libs/utils/smallstringview.h +++ b/src/libs/utils/smallstringview.h @@ -12,6 +12,12 @@ #include #include +#if __cpp_lib_constexpr_string >= 201907L +#define constexpr_string constexpr +#else +#define constexpr_string +#endif + namespace Utils { template @@ -63,7 +69,7 @@ public: return SmallStringView(data() + position, length); } - constexpr20 operator std::string() const { return std::string(data(), size()); } + constexpr_string operator std::string() const { return std::string(data(), size()); } explicit operator QString() const {