File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -398,15 +398,16 @@ auto assert_not_null(auto&& p CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT) -> declty
398
398
//
399
399
auto assert_in_bounds (auto && x, auto && arg CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT) -> decltype(auto )
400
400
requires (std::is_integral_v<CPP2_TYPEOF(arg)> &&
401
- requires { std::ssize (x); x[arg]; std::begin (x) + 2 ; })
401
+ requires { std::size (x); std:: ssize (x); x[arg]; std::begin (x) + 2 ; })
402
402
{
403
- Bounds.expects (0 <= arg && arg < std::ssize (x), " out of bounds access attempt detected" CPP2_SOURCE_LOCATION_ARG);
403
+ Bounds.expects (0 <= arg && arg < [&]() -> auto {
404
+ if constexpr (std::is_signed_v<CPP2_TYPEOF (arg)>) { return std::ssize (x); }
405
+ else { return std::size (x); }
406
+ }(), " out of bounds access attempt detected" CPP2_SOURCE_LOCATION_ARG);
404
407
return CPP2_FORWARD (x) [ CPP2_FORWARD (arg) ];
405
408
}
406
409
407
410
auto assert_in_bounds (auto && x, auto && arg CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT) -> decltype(auto )
408
- requires (!(std::is_integral_v<CPP2_TYPEOF(arg)> &&
409
- requires { std::ssize (x); x[arg]; std::begin (x) + 2 ; }))
410
411
{
411
412
return CPP2_FORWARD (x) [ CPP2_FORWARD (arg) ];
412
413
}
You can’t perform that action at this time.
0 commit comments