[libcxx-commits] [libcxx] [libc++] <algorithm>: __is_callable checks whether the callable can be called with rvalue (PR #73451)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 8 10:57:39 PST 2024


ldionne wrote:

> @ldionne it looks like there is a bug with the use of `std::lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());` in the file regex.cpp, because `use_strcmp` doesn't have a const reference operator overloading. Should we add one to that code?

Yes, we should add a const-qualification to `use_strcmp` in our own code.

@EricWF Now that I think about it some more, I think the issue these static asserts are addressing is that without them, we'll end up using `std::__invoke` to call the functions, which means that passing a PMF as a function would appear to work with classic algorithms, when in reality it's non-standard. So these static assertions are guarding us against Hyrum's law since our underlying algorithm implementation would allow for PMFs to be passed.

https://github.com/llvm/llvm-project/pull/73451


More information about the libcxx-commits mailing list