[libcxx-commits] [PATCH] D145285: [libc++] Refactor __less
Eric Fiselier via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 7 13:32:22 PST 2023
EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.
This cleanup seems incomplete. Why keep `__less` as a template at all given it's never actually used as one?
Also does the iterator's `::value_type` always have to exactly match the type returned from dereferencing it?
================
Comment at: libcxx/include/__algorithm/comp.h:37
+struct __less<void, void> {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __lhs, const _Up& __rhs) const {
----------------
This doesn't at all seem correct to me.
This takes away an explicit conversion
================
Comment at: libcxx/include/__algorithm/includes.h:64
includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
- return std::includes(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- __less<typename iterator_traits<_InputIterator1>::value_type,
- typename iterator_traits<_InputIterator2>::value_type>());
+ return std::includes(std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __less<>());
}
----------------
Is this correct? What if the iterator returns a type convertible to value_type?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145285/new/
https://reviews.llvm.org/D145285
More information about the libcxx-commits
mailing list