diff options
| author | Martin Hořeňovský | 2021-12-26 00:52:52 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-12-26 00:52:52 +0100 |
| commit | 156e6fdfa9122ea9b52fe6e65f20c66cf38688a7 (patch) | |
| tree | 2fc9498df69c65278c7f7ef8b97cc6bdc055cb90 | |
| parent | 187bf6db2bf6724481599526622f8881f4a46cee (diff) | |
| download | catch3-156e6fdfa9122ea9b52fe6e65f20c66cf38688a7.tar.gz | |
CaseInsensitiveLess takes args as StringRefs
| -rw-r--r-- | src/catch2/internal/catch_case_insensitive_comparisons.cpp | 4 | ||||
| -rw-r--r-- | src/catch2/internal/catch_case_insensitive_comparisons.hpp | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/catch2/internal/catch_case_insensitive_comparisons.cpp b/src/catch2/internal/catch_case_insensitive_comparisons.cpp index 3081edb3..3f81b219 100644 --- a/src/catch2/internal/catch_case_insensitive_comparisons.cpp +++ b/src/catch2/internal/catch_case_insensitive_comparisons.cpp @@ -14,8 +14,8 @@ namespace Catch { namespace Detail { - bool CaseInsensitiveLess::operator()( std::string const& lhs, - std::string const& rhs ) const { + bool CaseInsensitiveLess::operator()( StringRef lhs, + StringRef rhs ) const { return std::lexicographical_compare( lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), diff --git a/src/catch2/internal/catch_case_insensitive_comparisons.hpp b/src/catch2/internal/catch_case_insensitive_comparisons.hpp index 372809d4..6dfe712b 100644 --- a/src/catch2/internal/catch_case_insensitive_comparisons.hpp +++ b/src/catch2/internal/catch_case_insensitive_comparisons.hpp @@ -8,14 +8,16 @@ #ifndef CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED #define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED +#include <catch2/internal/catch_stringref.hpp> + #include <string> namespace Catch { namespace Detail { //! Provides case-insensitive `op<` semantics when called struct CaseInsensitiveLess { - bool operator()( std::string const& lhs, - std::string const& rhs ) const; + bool operator()( StringRef lhs, + StringRef rhs ) const; }; } // namespace Detail |