0

From the code it seems like ranges::actions::sort has

  • one overload that indeed forwards all arguments to ranges::sort,
  • and another one which… well, I've got a bit lost into the rabbit hole of bind_back and make_action_closure, but the point is that it takes just (C pred, P proj = {}), so I guess it's to be used in conjunction with the | operator; however, I don't really see if it ends up calling the other overloads (or directly ranges::sort).

How does that work?

Assuming the answer to the first question in the title is yes, then why have these pieces of code been separated in two headers? Do you see any advantage or necessity for doing so?

Enlico
  • 23,259
  • 6
  • 48
  • 102
  • 1
    "*however, I don't really see if it ends up calling the other overloads*" `sort_fn{}` construct a callable object whose call operator calls `ranges::sort`. – 康桓瑋 Aug 11 '23 at 06:15
  • @康桓瑋, oh right, I didn't realize the `return` was making use of the very class I was looking at :') – Enlico Aug 11 '23 at 06:44
  • By still, why another header and another namespace? Am I missing some technicality as to why this is necessary? Or is it likely just a choice that only Niebler knows the answer to (such as "I like it like this")? – Enlico Aug 11 '23 at 06:45

0 Answers0