21#ifndef ESPRESSO_INTEGRAL_PARAMETER_HPP
22#define ESPRESSO_INTEGRAL_PARAMETER_HPP
30template <
typename T,
template <T>
class F, T I, T N>
31struct integral_parameter_impl {
32 template <
class... Args>
static decltype(
auto) eval(T i, Args &&...args) {
34 return F<I>{}(std::forward<Args>(args)...);
36 return integral_parameter_impl<T, F, I + T{1}, N>::eval(
37 i, std::forward<Args>(args)...);
41template <
typename T,
template <T>
class F, T N>
42struct integral_parameter_impl<T, F, N, N> {
43 template <
class... Args>
static decltype(
auto) eval(T i, Args &&...args) {
45 return F<N>{}(std::forward<Args>(args)...);
47 throw std::runtime_error(
"Invalid parameter value");
56template <
typename T,
template <T>
class F, T
min, T max,
class... Args>
58 return detail::integral_parameter_impl<T, F, min, max>::eval(
59 i, std::forward<Args>(args)...);
decltype(auto) integral_parameter(T i, Args &&...args)
Generate a call table for an integral non-type template parameter.
int min(int i, unsigned int j)