[libcxx-commits] [PATCH] D132505: [libc++] Refactor deque::iterator algorithm optimizations
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 21 09:34:03 PST 2022
ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.
================
Comment at: libcxx/include/__iterator/segmented_iterator.h:53
+
+template <class _Iterator>
+struct __segmented_iterator_traits {
----------------
```
template <class _Iterator, class = void>
struct __segmented_iterator_traits;
/* exposition only:
{
using __segment_iterator = ...;
using __local_iterator = ...;
static __segment_iterator __segment(_Iterator);
static __local_iterator __local(_Iterator);
static __local_iterator __begin(__segment_iterator);
static __local_iterator __end(__segment_iterator);
static _Iterator __compose(__segment_iterator, __local_iterator);
};
*/
template <class _Tp, size_t>
constexpr bool __has_specialization_v = false;
template <class _Tp>
constexpr bool __has_specialization_v<_Tp, sizeof(_Tp)> = true;
template <class _Iterator>
using __is_segmented_iterator = bool_constant<__has_specialization_v<segmented_iterator_traits<_Iterator> >;
```
That way, we avoid forming `__segmented_iterator_traits` specializations for types that are not segmented iterators. That's more in-line with what we do for other traits classes, e.g. `char_traits`, `allocator_traits`, etc.
================
Comment at: libcxx/include/deque:399
+public:
+ using __is_segmented_iterator = true_type;
+ using __segment_iterator = _MapPointer;
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132505/new/
https://reviews.llvm.org/D132505
More information about the libcxx-commits
mailing list