Skip to content

Commit 2d3adc4

Browse files
TextView: Add utility CaselessEqual functor.
1 parent e73e88f commit 2d3adc4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

code/include/swoc/TextView.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -911,11 +911,12 @@ class TextView : public std::string_view {
911911
}
912912
};
913913

914+
/// Support for containers that need case insensitive comparisons between views.
914915
struct CaselessEqual {
915-
/// @return @c true if the strings are the same sans case.
916+
/// @return @c true if the view contants are equal when compared without regard to case.
916917
bool
917918
operator()(self_type const& lhs, self_type const& rhs) const noexcept {
918-
919+
return lhs.size() == rhs.size() && 0 == strcasecmp(lhs, rhs);
919920
}
920921
};
921922

0 commit comments

Comments
 (0)