From 76842f18bac578636c834ee4a879ec13f97b8fbe Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 26 Nov 2021 15:23:31 +1000 Subject: [PATCH] view: don't assert on redim to zero --- view.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/view.hpp b/view.hpp index 068f6332..d1f86a7c 100644 --- a/view.hpp +++ b/view.hpp @@ -306,7 +306,9 @@ namespace cruft { [[nodiscard]] constexpr auto redim (size_type count) const { - assert (count > 0); + if constexpr (std::is_signed_v) + assert (count >= 0); + if (count > size ()) throw std::invalid_argument ("redim to higher size not allowed"); return view { m_begin, m_begin + count };