Remove StringRef::isNullTerminated and StringRef::c_str

Both of them were fundamentally unsafe to use and shouldn't be used
at all.
This commit is contained in:
Martin Hořeňovský committed 2021-03-26 21:11:44 +01:00
1 parent e50e10ef8f
commit f1d7a10e06
9 files changed
+26 -178

No files matched your search

-8
View File
@@ -69,10 +69,6 @@ namespace Catch {
return m_size;
}
// Returns the current start pointer. If the StringRef is not
// null-terminated, throws std::domain_exception
auto c_str() const -> char const*;
public: // substrings and searches
// Returns a substring of [start, start + length).
// If start + length > size(), then the substring is [start, start + size()).
@@ -91,10 +87,6 @@ namespace Catch {
return m_start;
}
constexpr auto isNullTerminated() const noexcept -> bool {
return m_start[m_size] == '\0';
}
public: // iterators
constexpr const_iterator begin() const { return m_start; }
constexpr const_iterator end() const { return m_start + m_size; }