view: don't assert on redim to zero
This commit is contained in:
parent
0854405b2c
commit
76842f18ba
4
view.hpp
4
view.hpp
@ -306,7 +306,9 @@ namespace cruft {
|
|||||||
[[nodiscard]] constexpr auto
|
[[nodiscard]] constexpr auto
|
||||||
redim (size_type count) const
|
redim (size_type count) const
|
||||||
{
|
{
|
||||||
assert (count > 0);
|
if constexpr (std::is_signed_v<size_type>)
|
||||||
|
assert (count >= 0);
|
||||||
|
|
||||||
if (count > size ())
|
if (count > size ())
|
||||||
throw std::invalid_argument ("redim to higher size not allowed");
|
throw std::invalid_argument ("redim to higher size not allowed");
|
||||||
return view { m_begin, m_begin + count };
|
return view { m_begin, m_begin + count };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user