From 2d3adc47b79a203c19d748b02f4bbba26ecfdd56 Mon Sep 17 00:00:00 2001 From: "Alan M. Carroll" Date: Thu, 13 Jul 2023 11:47:26 -0500 Subject: [PATCH] TextView: Add utility CaselessEqual functor. --- code/include/swoc/TextView.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/include/swoc/TextView.h b/code/include/swoc/TextView.h index 9252a67..d65ae07 100644 --- a/code/include/swoc/TextView.h +++ b/code/include/swoc/TextView.h @@ -911,11 +911,12 @@ class TextView : public std::string_view { } }; + /// Support for containers that need case insensitive comparisons between views. struct CaselessEqual { - /// @return @c true if the strings are the same sans case. + /// @return @c true if the view contants are equal when compared without regard to case. bool operator()(self_type const& lhs, self_type const& rhs) const noexcept { - + return lhs.size() == rhs.size() && 0 == strcasecmp(lhs, rhs); } };