Created
November 14, 2019 19:32
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Return true if two values are equal. | |
A lexicographical comparison is performed | |
to determine if the two strings are equal. | |
*/ | |
template<class T | |
, class = typename std::enable_if< | |
std::is_convertible< | |
T const&, string_view>::value | |
>::type | |
> | |
bool | |
operator==(string const& lhs, T const& rhs) noexcept | |
{ | |
return string_view(lhs) == string_view(rhs); | |
} | |
/** Return true if two values are equal. | |
A lexicographical comparison is performed | |
to determine if the two strings are equal. | |
*/ | |
template<class T | |
#ifndef GENERATING_DOCUMENTATION | |
, class = typename std::enable_if< | |
std::is_convertible< | |
T const&, string_view>::value && | |
! std::is_base_of<string, T>::value | |
>::type | |
#endif | |
> | |
bool operator==(T const& lhs, string const& rhs) noexcept | |
{ | |
return string_view(lhs) == string_view(rhs); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment