Как заставить работать шаблон с enable_if, который должен принимать контейнер с содержимым нужного типа?

Хочу написать шаблон, который будет принимать контейнер точек. Данная перегрузка расчитана на наличие у Point методов Point::x() и Point::y():

template<
    typename Point,
    template<typename> typename Container,
    typename = std::enable_if_t // SFINAE
    <
           std::is_invocable_v<decltype(&Point::x),Point>
        && std::is_invocable_v<decltype(&Point::y),Point>

        && is_numeric_v<return_type_t<decltype(&Point::x)>>
        && is_numeric_v<return_type_t<decltype(&Point::y)>>

        && std::is_invocable_v<decltype(&Container<Point>::begin),Container<Point>>
        && std::is_invocable_v<decltype(&Container<Point>::end),Container<Point>>
    >
>
double calc_intersection_percentage(Container<Point> polygon)
{ return 0.0; }

Вот такой код выводит только true:

std::clog << std::boolalpha                                                
          << std::is_invocable_v<decltype(&MyPoint::x),MyPoint> << std::endl 
          << std::is_invocable_v<decltype(&MyPoint::y),MyPoint> << std::endl 
          << is_numeric_v<return_type_t<decltype(&MyPoint::x)>> << std::endl 
          << is_numeric_v<return_type_t<decltype(&MyPoint::y)>> << std::endl;

При попытке вызова:

std::vector<MyPoint> polygon = {
    {1,1},{2,2},{3,3},{4,4},{5,5},{6,6},{7,7}
};
calc_intersection_percentage(polygon);

Валится ошибка:

error: no matching function for call to 'calc_intersection_percentage'
note: candidate template ignored: substitution failure
[with Point = MyPoint]: template template argument has different
template parameters than its corresponding template template parameter

Не могу понять, что я делаю не так?


Ответы (0 шт):