[libcxx-commits] [PATCH] D93562: [libc++] Add a missing `<_Compare>` template argument.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 12 07:25:37 PST 2021


ldionne added a comment.

I'd like to have other people's opinions on this, but wouldn't it make more sense to pass `std::ref(comparator)` down to implementation-detail algorithms inside the library, and let those assume that they can copy the predicate cheaply? That would give us what Arthur was suggesting would be better above:

> It would actually be very nice if we could just make the invariant that "_Compare is a value type that is cheap to copy (e.g. reference_wrapper<T>)," and then we'd never need to specify <_Compare> on any helper ever again...

In other words, why not do just that?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93562/new/

https://reviews.llvm.org/D93562



More information about the libcxx-commits mailing list