From 49b8594a73f7c8519c7a2ec70e05114a5b3a3bb4 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sun, 16 Dec 2018 16:25:04 +1100 Subject: [PATCH] view: add some brief explanatory comments --- view.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/view.hpp b/view.hpp index f813b056..2d0c98d8 100644 --- a/view.hpp +++ b/view.hpp @@ -230,27 +230,23 @@ namespace cruft { /////////////////////////////////////////////////////////////////////// + /// Returns true if the size of the view is zero. constexpr bool empty (void) const noexcept { return m_begin == m_end; } - //--------------------------------------------------------------------- - // the return type of size _should_ be whatever std::distance returns, - // or something else that makes sense for the iterators we've been - // handed. - // - // but it's a pain in the arse to use sizes that aren't unsigned given - // that other libraries need to compare sizes pretty often and - // everything else in the world tends to be unsigned. + ///-------------------------------------------------------------------- + /// Returns the number of items in the view. constexpr auto size (void) const noexcept { return static_cast (std::distance (m_begin, m_end)); } - //--------------------------------------------------------------------- + ///-------------------------------------------------------------------- + /// Returns a subview of the first `count` elements of this view. [[nodiscard]] constexpr auto redim (size_type count) const { @@ -261,7 +257,11 @@ namespace cruft { }; - //--------------------------------------------------------------------- + ///-------------------------------------------------------------------- + /// Returns two subviews split at `pos`. + /// + /// The first view extends from `begin` to `pos`, and the second view + /// extends from `pos` to `end`. [[nodiscard]] constexpr std::pair< view, view @@ -275,7 +275,7 @@ namespace cruft { } - //--------------------------------------------------------------------- + ///-------------------------------------------------------------------- template < typename IndexT, typename = std::enable_if_t>