BDE 4.14.0 Production release
|
Provide a case-insensitive equality predicate for string views.
This component provides a struct
, bdlb::CaselessStringViewEqualTo
, that defines a functor that checks two string views for equality using a case-insensitive string comparison. This comparison functor is suitable for supporting bsl::string
s or bsl::string_view
s as keys in unordered associative containers.
Note that using this component to do comparisons of keys in a container is less efficient than converting all the keys to the same case prior to insertion and then just doing straight string comparisons.
This section illustrates intended use of this component.
Suppose we have some strings that compare equal, some that don't, and some of which are equal except for the cases of some of the letters.
Now, we create an object of type bdlb::CaselessStringViewEqualTo
to do the comparisons:
Finally, we observe that a
matches b
, but neither matches c
: