view: add ssize query

This commit is contained in:
Danny Robson 2019-05-12 07:53:08 +10:00
parent 52467c056d
commit da6d5cb2a8

View File

@ -276,6 +276,16 @@ namespace cruft {
return static_cast<size_type> (std::distance (m_begin, m_end));
}
///--------------------------------------------------------------------
/// Returns a signed count of items in the view.
constexpr ssize_t
ssize (void) const noexcept
{
return std::distance (m_begin, m_end);
}
///--------------------------------------------------------------------
/// Returns a subview of the first `count` elements of this view.
[[nodiscard]] constexpr auto