Skip to content

Commit

Permalink
Reintroduce String::String(const std::string_view&) without constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
thirtythreeforty committed Oct 18, 2024
1 parent 6b04262 commit bd63c7f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions distrho/extra/String.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

#include <algorithm>

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

START_NAMESPACE_DISTRHO

// -----------------------------------------------------------------------
Expand Down Expand Up @@ -87,6 +91,16 @@ class String
_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.
*/
Expand Down

0 comments on commit bd63c7f

Please sign in to comment.