diff options
| author | Martin Hořeňovský | 2019-09-07 20:13:22 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-09-07 20:13:22 +0200 |
| commit | fe967b1f4122a67ae1b31febf26cf1751917a0eb (patch) | |
| tree | 8b1cceef764a2943b38541460325f3b0b04e6f4c /include/internal/catch_stringref.cpp | |
| parent | f2c2711bdcc583938e444f2039b9ceba840defcf (diff) | |
| download | catch3-fe967b1f4122a67ae1b31febf26cf1751917a0eb.tar.gz | |
Remove the ill-considered StringRef::numberOfCharacters
It never counted characters, only codepoints. If you think these
are interchangeable, you should not touch non-ascii text.
Diffstat (limited to 'include/internal/catch_stringref.cpp')
| -rw-r--r-- | include/internal/catch_stringref.cpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/include/internal/catch_stringref.cpp b/include/internal/catch_stringref.cpp index 90a320c9..8e6741b1 100644 --- a/include/internal/catch_stringref.cpp +++ b/include/internal/catch_stringref.cpp @@ -17,12 +17,6 @@ #include <cstring> #include <cstdint> -namespace { - const uint32_t byte_2_lead = 0xC0; - const uint32_t byte_3_lead = 0xE0; - const uint32_t byte_4_lead = 0xF0; -} - namespace Catch { StringRef::StringRef( char const* rawChars ) noexcept : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) ) @@ -82,22 +76,6 @@ namespace Catch { return m_start[index]; } - auto StringRef::numberOfCharacters() const noexcept -> size_type { - size_type noChars = m_size; - // Make adjustments for uft encodings - for( size_type i=0; i < m_size; ++i ) { - char c = m_start[i]; - if( ( c & byte_2_lead ) == byte_2_lead ) { - noChars--; - if (( c & byte_3_lead ) == byte_3_lead ) - noChars--; - if( ( c & byte_4_lead ) == byte_4_lead ) - noChars--; - } - } - return noChars; - } - auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string { std::string str; str.reserve( lhs.size() + rhs.size() ); |