llvm /
libcxx /
9b96c3dbd4e89c10d9fd8364da4b65f93c6f4276 [libc++] Fix build failure with _LIBCPP_DEBUG=0 when iterators return values instead of references
There are many STL algorithms (such as lexicographical_compare) that compare
values pointed to by iterators like so:
__comp(*it1, *it2);
When building with `_LIBCPP_DEBUG=0`, comparators are wrapped in `__debug_less`
which does some additional validation. But `__debug_less::operator()` takes
non-const references, so if the type of `*it1` is int, not int&, then the build
will fail.
This change adds a `const&` overload for `operator()` to fix the build.
Differential Revision: https://reviews.llvm.org/D60592
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@358423 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed