[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

llvm-svn: 358423
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 22adcc8..244ae2d 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -785,6 +785,15 @@
     __debug_less(_Compare& __c) : __comp_(__c) {}
 
     template <class _Tp, class _Up>
+    bool operator()(const _Tp& __x,  const _Up& __y)
+    {
+        bool __r = __comp_(__x, __y);
+        if (__r)
+            __do_compare_assert(0, __y, __x);
+        return __r;
+    }
+
+    template <class _Tp, class _Up>
     _LIBCPP_CONSTEXPR_AFTER_CXX17
     bool operator()(_Tp& __x,  _Up& __y)
     {