[libcxx-commits] [PATCH] D128864: [libc++] Fix algorihtms which use reverse_iterator

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 29 16:41:34 PDT 2022

philnik added a reviewer: EricWF.
philnik added a comment.

It's quite a bit of code duplication and complexity for `__unwrap_iter_impl`, but I think it's the best solution. Using `reverse_iterator` and other wrappers allows us to simplify a lot of algorithms. Not having a C++20-compatible `reverse_iterator` would also mean that we'd have to duplicate `__half_inplace_merge`. I'm open to other suggestions though. I hope we can remove `_AlgRevIter` in a few versions, since it's clearly a language bug. (BTW did anybody file a CWG issue yet?)

Comment at: libcxx/include/__iterator/iterator_traits.h:492-496
+template <class _Iter>
+using __iterator_category_type = typename iterator_traits<_Iter>::iterator_category;
+template <class _Iter>
+using __iterator_pointer_type = typename iterator_traits<_Iter>::pointer;
I'm planning to use these in other parts of the code base, but I think it would be better to do this in NFC patches.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list