view: add string comparison operators
This commit is contained in:
parent
41cf6c3d51
commit
bfa5700df0
18
view.hpp
18
view.hpp
@ -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>
|
||||
std::ostream&
|
||||
|
Loading…
Reference in New Issue
Block a user