From da6d5cb2a8237075f45b9519682bf7168494b700 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sun, 12 May 2019 07:53:08 +1000 Subject: [PATCH] view: add ssize query --- view.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/view.hpp b/view.hpp index dc09e72a..0a50c6b3 100644 --- a/view.hpp +++ b/view.hpp @@ -276,6 +276,16 @@ namespace cruft { return static_cast (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