Morwenn / cpp-sort

Sorting algorithms & related tools for C++14
MIT License
617 stars 57 forks source link

Make indirect_adapter<spread_sorter> work with a projection #204

Closed Morwenn closed 2 years ago

Morwenn commented 2 years ago

As mentioned in #203, passing a collection to sort and a projection to indirect_adapter<spread_sorter> doesn't compile and barfs thousands of lines of template error messages. Theoretically it should work since nothing in indirect_adapter requires the comparison to work: this was the conclusion of issue #138, but the tests weren't good enough and let simple yet obvious cases slip through the holes.

My initial guess is that indirect_adapter_impl::operator() doesn't perform enough SFINAE: it uses decltype(auto) which probably makes some expressions of interest ill-formed when we need proper SFINAE for them to work.