view: add implicit bool operator for 'not empty'

This commit is contained in:
Danny Robson 2019-05-12 07:52:54 +10:00
parent 01e46c7725
commit 52467c056d

View File

@ -259,6 +259,15 @@ namespace cruft {
return m_begin == m_end; return m_begin == m_end;
} }
///--------------------------------------------------------------------
/// Returns true if the view is not empty; ie, there is data remaining.
constexpr operator bool () const noexcept
{
return not empty ();
}
///-------------------------------------------------------------------- ///--------------------------------------------------------------------
/// Returns the number of items in the view. /// Returns the number of items in the view.
constexpr auto constexpr auto