Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:45

0001 #ifndef BOOST_CLBL_TRTS_PARAMETER_INDEX_HELPER_HPP
0002 #define BOOST_CLBL_TRTS_PARAMETER_INDEX_HELPER_HPP
0003 
0004 #include <boost/callable_traits/detail/config.hpp>
0005 
0006 namespace boost { namespace callable_traits { namespace detail {
0007 
0008 template<std::size_t I, typename T, bool IgnoreThisPointer = false,
0009     bool AllowPlus1 = false, std::size_t Count = 0>
0010 struct parameter_index_helper {
0011 
0012     using error_t = error_type<T>;
0013 
0014     using args_tuple = typename std::conditional<IgnoreThisPointer,
0015         typename detail::traits<T>::non_invoke_arg_types,
0016         typename detail::traits<T>::arg_types>::type;
0017 
0018     static constexpr bool has_parameter_list =
0019         !std::is_same<args_tuple, invalid_type>::value
0020         && !std::is_same<args_tuple, reference_error>::value;
0021 
0022     using temp_tuple = typename std::conditional<has_parameter_list,
0023         args_tuple, std::tuple<error_t>>::type;
0024 
0025     static constexpr std::size_t parameter_list_size =
0026         std::tuple_size<temp_tuple>::value;
0027 
0028     static constexpr bool is_out_of_range = has_parameter_list &&
0029         I >= parameter_list_size + static_cast<std::size_t>(AllowPlus1);
0030 
0031     static constexpr bool is_count_out_of_range = has_parameter_list &&
0032         I + Count > parameter_list_size + static_cast<std::size_t>(AllowPlus1);
0033 
0034     static constexpr std::size_t index =
0035         has_parameter_list && !is_out_of_range ? I : 0;
0036 
0037     static constexpr std::size_t count =
0038         has_parameter_list && !is_count_out_of_range ? Count : 0;
0039 
0040     using permissive_tuple = typename std::conditional<
0041         has_parameter_list && !is_out_of_range,
0042         args_tuple, std::tuple<error_t>>::type;
0043 
0044     using permissive_function = typename std::conditional<
0045         has_parameter_list && !is_out_of_range,
0046         T, error_t(error_t)>::type;
0047 };
0048 
0049 }}} // namespace boost::callable_traits::detail
0050 
0051 #endif // #ifndef BOOST_CLBL_TRTS_PARAMETER_INDEX_HELPER_HPP