diff --git a/src/tools/ranges/ViewBase.hpp b/src/tools/ranges/ViewBase.hpp index 63224d9..f0f65e3 100644 --- a/src/tools/ranges/ViewBase.hpp +++ b/src/tools/ranges/ViewBase.hpp @@ -2,6 +2,7 @@ #define NJOY_TOOLS_RANGES_VIEWBASE // system includes +#include #include // other includes @@ -45,6 +46,7 @@ class ViewBase { typename Range::iterator > = true > constexpr decltype(auto) front() const noexcept { + assert( ( !this->empty(), "front(): view is empty" ) ); return *( this->derived().begin() ); } @@ -56,6 +58,7 @@ class ViewBase { typename Range::iterator > = true > constexpr decltype(auto) back() const noexcept { + assert( ( !this->empty(), "back(): view is empty" ) ); return *( std::prev( this->derived().end() ) ); }