diff --git a/view.hpp b/view.hpp index 88717b3c..1ad32aaa 100644 --- a/view.hpp +++ b/view.hpp @@ -340,7 +340,13 @@ namespace cruft { [[nodiscard]] constexpr auto split (IndexT idx) const { - CHECK_LIMIT (idx, IndexT {0u}, cruft::cast::lossless (size ())); + // It's ok if `idx` points to the end iterator; this just means the + // second element of the returned pair is an empty view. + static_assert ( + std::numeric_limits::max () <= std::numeric_limits::max () + ); + CHECK_GE (idx, IndexT {0}); + CHECK_LE (cruft::cast::lossless (idx), size ()); auto last = m_begin; std::advance (last, idx);