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>