diff --git a/view.hpp b/view.hpp index da349e9c..88717b3c 100644 --- a/view.hpp +++ b/view.hpp @@ -340,7 +340,7 @@ namespace cruft { [[nodiscard]] constexpr auto split (IndexT idx) const { - CHECK_LE (cruft::cast::lossless (idx), size ()); + CHECK_LIMIT (idx, IndexT {0u}, cruft::cast::lossless (size ())); auto last = m_begin; std::advance (last, idx); @@ -479,6 +479,7 @@ namespace cruft { constexpr auto&& operator[] (size_t idx) noexcept { + CHECK_LIMIT (idx, 0u, size ()); return *std::next (begin (), idx); } @@ -486,6 +487,7 @@ namespace cruft { constexpr auto&& operator[] (size_t idx) const noexcept { + CHECK_LIMIT (idx, 0u, size ()); return *std::next (begin (), idx); }