[libcxx-commits] [libcxx] [libcxx] Added segment iterator for fill (PR #104680)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Aug 17 12:17:55 PDT 2024
================
@@ -21,23 +21,64 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
-template <class _ForwardIterator, class _Tp>
+template <
+ class _ForwardIterator,
+ class _Tp,
+ __enable_if_t<
+ is_same<typename iterator_traits<_ForwardIterator>::iterator_category, forward_iterator_tag>::value ||
+ is_same<typename iterator_traits<_ForwardIterator>::iterator_category, bidirectional_iterator_tag>::value,
----------------
philnik777 wrote:
This is wrong. Users are allowed to add their own iterator categories that derive from standard ones. You should use the `__has_x_iterator_category` utilities instead. In this case it could simply be `!__has_random_access_iterator_category<_ForwardIterator>::value`. Same below.
https://github.com/llvm/llvm-project/pull/104680
More information about the libcxx-commits
mailing list