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 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(),

View File

@ -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