85 ArgTypeGetter get_arg_type, ParamTypeGetter get_param_type,
87 std::vector<OverloadCandidate<T>> candidates;
89 for (
const auto& item : overloads) {
90 int conversion_count = 0;
91 int first_conversion_index = -1;
94 for (
size_t j = 0; j < arg_count; ++j) {
95 std::optional<Type> arg_type_opt = get_arg_type(item, j);
96 std::optional<Type> param_type_opt = get_param_type(item, j);
98 if (!arg_type_opt.has_value() || !param_type_opt.has_value()) {
103 Type arg_type = arg_type_opt.value();
104 Type param_type = param_type_opt.value();
106 if (arg_type != param_type) {
109 if (first_conversion_index == -1) {
110 first_conversion_index =
static_cast<int>(j);
120 candidates.push_back(
121 {&item, conversion_count, first_conversion_index});
bool is_ambiguous(const std::vector< OverloadCandidate< T > > &candidates, const OverloadCandidate< T > *best)
std::vector< OverloadCandidate< T > > compute_candidates(const std::vector< T > &overloads, size_t arg_count, ArgTypeGetter get_arg_type, ParamTypeGetter get_param_type, Mode mode)
bool is_convertible(Type from, Type to, Mode mode)
const OverloadCandidate< T > * select_best_candidate(std::vector< OverloadCandidate< T > > &candidates)
int first_conversion_index