view: add front and back observers

This commit is contained in:
Danny Robson 2019-02-08 11:59:24 +11:00
parent 80e9542328
commit 2a9be46d54

View File

@ -242,6 +242,14 @@ namespace cruft {
auto data (void) noexcept { return begin (); } auto data (void) noexcept { return begin (); }
auto data (void) const noexcept { return begin (); } auto data (void) const noexcept { return begin (); }
//---------------------------------------------------------------------
auto& front (void) noexcept { return *m_begin; }
auto& front (void) const noexcept { return *m_begin; }
//---------------------------------------------------------------------
auto& back (void) noexcept { return *(m_end - 1); }
auto& back (void) const noexcept { return *(m_end - 1); }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
/// Returns true if the size of the view is zero. /// Returns true if the size of the view is zero.