|
|
|||
File indexing completed on 2026-05-03 08:13:33
0001 //===----------------------------------------------------------------------===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 0009 #ifndef _LIBCPP___CXX03___SEGMENTED_ITERATOR_H 0010 #define _LIBCPP___CXX03___SEGMENTED_ITERATOR_H 0011 0012 // Segmented iterators are iterators over (not necessarily contiguous) sub-ranges. 0013 // 0014 // For example, std::deque stores its data into multiple blocks of contiguous memory, 0015 // which are not stored contiguously themselves. The concept of segmented iterators 0016 // allows algorithms to operate over these multi-level iterators natively, opening the 0017 // door to various optimizations. See http://lafstern.org/matt/segmented.pdf for details. 0018 // 0019 // If __segmented_iterator_traits can be instantiated, the following functions and associated types must be provided: 0020 // - Traits::__local_iterator 0021 // The type of iterators used to iterate inside a segment. 0022 // 0023 // - Traits::__segment_iterator 0024 // The type of iterators used to iterate over segments. 0025 // Segment iterators can be forward iterators or bidirectional iterators, depending on the 0026 // underlying data structure. 0027 // 0028 // - static __segment_iterator Traits::__segment(It __it) 0029 // Returns an iterator to the segment that the provided iterator is in. 0030 // 0031 // - static __local_iterator Traits::__local(It __it) 0032 // Returns the local iterator pointing to the element that the provided iterator points to. 0033 // 0034 // - static __local_iterator Traits::__begin(__segment_iterator __it) 0035 // Returns the local iterator to the beginning of the segment that the provided iterator is pointing into. 0036 // 0037 // - static __local_iterator Traits::__end(__segment_iterator __it) 0038 // Returns the one-past-the-end local iterator to the segment that the provided iterator is pointing into. 0039 // 0040 // - static It Traits::__compose(__segment_iterator, __local_iterator) 0041 // Returns the iterator composed of the segment iterator and local iterator. 0042 0043 #include <__cxx03/__config> 0044 #include <__cxx03/__type_traits/integral_constant.h> 0045 #include <__cxx03/cstddef> 0046 0047 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 0048 # pragma GCC system_header 0049 #endif 0050 0051 _LIBCPP_BEGIN_NAMESPACE_STD 0052 0053 template <class _Iterator> 0054 struct __segmented_iterator_traits; 0055 /* exposition-only: 0056 { 0057 using __segment_iterator = ...; 0058 using __local_iterator = ...; 0059 0060 static __segment_iterator __segment(_Iterator); 0061 static __local_iterator __local(_Iterator); 0062 static __local_iterator __begin(__segment_iterator); 0063 static __local_iterator __end(__segment_iterator); 0064 static _Iterator __compose(__segment_iterator, __local_iterator); 0065 }; 0066 */ 0067 0068 template <class _Tp, size_t = 0> 0069 struct __has_specialization : false_type {}; 0070 0071 template <class _Tp> 0072 struct __has_specialization<_Tp, sizeof(_Tp) * 0> : true_type {}; 0073 0074 template <class _Iterator> 0075 using __is_segmented_iterator = __has_specialization<__segmented_iterator_traits<_Iterator> >; 0076 0077 _LIBCPP_END_NAMESPACE_STD 0078 0079 #endif // _LIBCPP___CXX03___SEGMENTED_ITERATOR_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|