From 156e6fdfa9122ea9b52fe6e65f20c66cf38688a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 26 Dec 2021 00:52:52 +0100 Subject: [PATCH] CaseInsensitiveLess takes args as StringRefs --- src/catch2/internal/catch_case_insensitive_comparisons.cpp | 4 ++-- 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 + #include 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