[libcxx-commits] [libcxx] [libc++] Fix insertion into `deque` from prvalue ranges (PR #160022)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 21 23:59:30 PDT 2025


================
@@ -1916,6 +1917,12 @@ template <class _Tp, class _Allocator>
 template <class _BiIter>
 _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
 deque<_Tp, _Allocator>::__insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n) {
+#  if _LIBCPP_STD_VER >= 20
+  using _Ops = _IterOps<
+      conditional_t<__has_bidirectional_iterator_category<_BiIter>::value, _ClassicAlgPolicy, _RangeAlgPolicy>>;
+#  else
+  using _Ops = _IterOps<_ClassicAlgPolicy>;
+#  endif
----------------
philnik777 wrote:

IMO it'd make more sense to pass this as a template argument like we do for algorithms. That avoids any accidental extensions or regressions.

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


More information about the libcxx-commits mailing list