CaseInsensitiveLess takes args as StringRefs

This commit is contained in:
Martin Hořeňovský 2021-12-26 00:52:52 +01:00
parent 187bf6db2b
commit 156e6fdfa9
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 6 additions and 4 deletions

View File

@ -14,8 +14,8 @@
namespace Catch { namespace Catch {
namespace Detail { namespace Detail {
bool CaseInsensitiveLess::operator()( std::string const& lhs, bool CaseInsensitiveLess::operator()( StringRef lhs,
std::string const& rhs ) const { StringRef rhs ) const {
return std::lexicographical_compare( return std::lexicographical_compare(
lhs.begin(), lhs.end(), lhs.begin(), lhs.end(),
rhs.begin(), rhs.end(), rhs.begin(), rhs.end(),

View File

@ -8,14 +8,16 @@
#ifndef CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED #ifndef CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED
#define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED #define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED
#include <catch2/internal/catch_stringref.hpp>
#include <string> #include <string>
namespace Catch { namespace Catch {
namespace Detail { namespace Detail {
//! Provides case-insensitive `op<` semantics when called //! Provides case-insensitive `op<` semantics when called
struct CaseInsensitiveLess { struct CaseInsensitiveLess {
bool operator()( std::string const& lhs, bool operator()( StringRef lhs,
std::string const& rhs ) const; StringRef rhs ) const;
}; };
} // namespace Detail } // namespace Detail