Template Function ripple::unrolled_for_bounded¶
Defined in File unrolled_for.hpp
Function Documentation¶
-
template<size_t
Amount
, typenameFunctor
, typename ...Args
, unroll_enabled_t<Amount> = 0>
constexpr autoripple
::
unrolled_for_bounded
(Functor &&functor, Args&&... args) noexcept -> void¶ Applies the functor Amount times.
However, this is a bounded version and is safer than
unrolled_for
in that it will not unroll if the value of Amount is larger than the value defined byripple_max_unroll_depth
at compile time.In the case that Amount is larger than
ripple_max_unroll_length
then a normal loop is performed and the functor is invoked on each iteration.This overload is only enabled when
Amount < ripple_max_unroll_depth
.- Note
This version will not always use a constexpr index, and therefore the index cannot be used in constexpr contexts.
However, this is a bounded version and is safer than
unrolled_for
in that it will not unroll if the value of Amount is larger than the value defined byripple_max_unroll_depth
at compile time.- Parameters
functor
: The functor to unroll.args
: The arguments to the functor.
- Template Parameters
Amount
: The amount of unrolling to do.Functor
: The type of the functor.Args
: The type of the functor arguments.
In the case that Amount is larger than
ripple_max_unroll_length
then a normal loop is performed and the functor is invoked on each iteration.This version will not always used a constexpr index, and therefore the index cannot be used in constexpr contexts.
This overload is only enabled when
Amount >= ripple_max_unroll_depth
.- Parameters
functor
: The functor to unroll.args
: The arguments to the functor.
- Template Parameters
Amount
: The amount of unrolling to do.Functor
: The type of the functor.Args
: The type of the functor arguments.