forked from qt-creator/qt-creator
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 <ci_patchbuild_bot@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -12,6 +12,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
|
#if __cpp_lib_constexpr_string >= 201907L
|
||||||
|
#define constexpr_string constexpr
|
||||||
|
#else
|
||||||
|
#define constexpr_string
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
template <typename String>
|
template <typename String>
|
||||||
@@ -63,7 +69,7 @@ public:
|
|||||||
return SmallStringView(data() + position, length);
|
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
|
explicit operator QString() const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user