1/*============================================================================= 2 Copyright (c) 2016 Paul Fultz II 3 function_param_limit.hpp 4 Distributed under the Boost Software License, Version 1.0. (See accompanying 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6==============================================================================*/ 7 8#ifndef BOOST_HOF_GUARD_FUNCTION_PARAM_LIMIT_HPP 9#define BOOST_HOF_GUARD_FUNCTION_PARAM_LIMIT_HPP 10 11/// function_param_limit 12/// ==================== 13/// 14/// Description 15/// ----------- 16/// 17/// The `function_param_limit` metafunction retrieves the maximum number of 18/// parameters for a function. For function pointers it returns the number of 19/// parameters. Everything else, it returns `SIZE_MAX`, but this can be 20/// changed by annotating the function with the [`limit`](limit) decorator. 21/// 22/// This is a type trait that inherits from `std::integral_constant`. 23/// 24/// Synopsis 25/// -------- 26/// 27/// template<class F> 28/// struct function_param_limit 29/// : std::integral_constant<std::size_t, ...> 30/// {}; 31/// 32/// See Also 33/// -------- 34/// 35/// * [Partial function evaluation](<Partial function evaluation>) 36/// * [limit](limit) 37/// 38 39#include <boost/hof/detail/holder.hpp> 40#include <type_traits> 41#include <cstdint> 42 43namespace boost { namespace hof { 44 45template<class F, class=void> 46struct function_param_limit 47: std::integral_constant<std::size_t, SIZE_MAX> 48{}; 49 50template<class F> 51struct function_param_limit<F, typename detail::holder<typename F::fit_function_param_limit>::type> 52: F::fit_function_param_limit 53{}; 54 55}} // namespace boost::hof 56 57#endif 58