view: add string comparison operators

This commit is contained in:
Danny Robson 2018-04-01 14:44:15 +10:00
parent 41cf6c3d51
commit bfa5700df0

View File

@ -684,6 +684,24 @@ namespace util {
} }
///////////////////////////////////////////////////////////////////////////
template <typename CharT>
bool
operator== (
util::view<const CharT*> lhs,
const std::basic_string<CharT> &rhs
) {
return lhs.size () == rhs.size () && std::equal (lhs.cbegin (), lhs.cend (), rhs.cbegin ());
}
inline bool
operator== (util::view<const char*> lhs, const char *rhs)
{
return lhs.size () == strlen (rhs) && std::equal (lhs.cbegin (), lhs.cend (), rhs);
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template <typename BeginT, typename EndT> template <typename BeginT, typename EndT>
std::ostream& std::ostream&