12#include "../macros.hpp"
13#include "exception.hpp"
17hi_export_module(hikogui.utility.assert);
21hi_warning_ignore_msvc(26472);
23hi_export
namespace hi {
inline namespace v1 {
33 return std::cmp_less(index,
upper);
48 hi_assert_abort(
"bound_check() lower is greater than upper.");
54 return std::cmp_greater_equal(index,
lower)
and std::cmp_less(index,
upper);
69 hi_assert_abort(
"bound_check() lower is greater than upper.");
78template<
typename Context>
81 std::ranges::size(
range)
82 } -> std::unsigned_integral;
93 static_assert(
sizeof(index) <=
sizeof(
size_t));
95 if constexpr (std::is_signed_v<std::decay_t<
decltype(index)>>) {
101 return static_cast<size_t>(index) < std::ranges::size(
range);
Utilities for throwing exceptions and terminating the application.
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
The HikoGUI namespace.
Definition recursive_iterator.hpp:15
hi_export constexpr bool bound_check(std::integral auto index, std::integral auto upper) noexcept
Check if an index is less than the bound.
Definition assert.hpp:31
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:378