[libcxx-commits] [libcxx] [libc++] Disallow std::prev(non_cpp17_bidi_iterator) (PR #112102)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Oct 19 02:16:54 PDT 2024


================
@@ -35,6 +39,13 @@ prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n =
   return __x;
 }
 
+template <class _BidirectionalIterator,
+          __enable_if_t<__has_bidirectional_iterator_category<_BidirectionalIterator>::value, int> = 0>
----------------
huixie90 wrote:

sure. stick to two overloads approach with both enable if on the "input_iterator_tag" and added `static_assert` on the second overload

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


More information about the libcxx-commits mailing list