79368921

Date: 2025-01-19 12:15:51
Score: 1.5
Natty:
Report link

As @HolyBlackCat pointed out, using a class with specializations and a static member function (and using a separate function as a nicer interface to the specializations) solves the problem. The class specialization for ranges now looks like this:

template <sink_c sink_t, std::ranges::sized_range value_t>
requires requires(sink_t& sink, std::ranges::range_value_t<value_t> element) {
    { DefaultWrite<sink_t, std::ranges::range_value_t<value_t>>::call(sink, element) };
}
struct DefaultWrite<sink_t, value_t> {
    static void call(sink_t& sink, value_t const& value);
};
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @HolyBlackCat
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: AdamantConlanger