Browse Source

Reintroduce String::String(const std::string_view&) without constexpr

pull/473/head
George Hilliard 6 months ago
parent
commit
bd63c7f2c2
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      distrho/extra/String.hpp

+ 14
- 0
distrho/extra/String.hpp View File

@@ -22,6 +22,10 @@


#include <algorithm> #include <algorithm>


#if __cplusplus >= 201703L
# include <string_view>
#endif

START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -87,6 +91,16 @@ public:
_dup(strBuf); _dup(strBuf);
} }


#if __cplusplus >= 201703L
/*
* std::string_view, not requiring a null terminator
*/
explicit String(const std::string_view& strView) noexcept
: fBuffer(const_cast<char*>(strView.data())),
fBufferLen(strView.size()),
fBufferAlloc(false) {}
#endif

/* /*
* Integer. * Integer.
*/ */


Loading…
Cancel
Save