limit¶
Header¶
#include <fit/limit.hpp>
Description¶
The limit
function decorator annotates the function with the max number
of parameters. The limit_c
version can be used to give the max number
directly(instead of relying on an integral constant). The parameter limit
can be read by using the function_param_limit
trait. Using limit
is useful to improve error reporting with partially
evaluated functions.
Synopsis¶
template<class IntegralConstant>
constexpr auto limit(IntegralConstant);
template<std::size_t N, class F>
constexpr auto limit_c(F);
Example¶
#include <fit.hpp>
#include <cassert>
using namespace fit;
struct sum_f
{
template<class T>
int operator()(T x, T y) const
{
return x+y;
}
};
FIT_STATIC_FUNCTION(sum) = limit_c<2>(sum_f());
int main() {
assert(3 == sum(1, 2));
}