From bd63c7f2c29d12d3aa262b97dd099decd577fdc4 Mon Sep 17 00:00:00 2001 From: George Hilliard Date: Thu, 17 Oct 2024 20:57:41 -0500 Subject: [PATCH] Reintroduce String::String(const std::string_view&) without constexpr --- distrho/extra/String.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/distrho/extra/String.hpp b/distrho/extra/String.hpp index 0255bcd1..f302bfaf 100644 --- a/distrho/extra/String.hpp +++ b/distrho/extra/String.hpp @@ -22,6 +22,10 @@ #include +#if __cplusplus >= 201703L +# include +#endif + START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- @@ -87,6 +91,16 @@ public: _dup(strBuf); } + #if __cplusplus >= 201703L + /* + * std::string_view, not requiring a null terminator + */ + explicit String(const std::string_view& strView) noexcept + : fBuffer(const_cast(strView.data())), + fBufferLen(strView.size()), + fBufferAlloc(false) {} + #endif + /* * Integer. */