ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Iterators.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*---------------------------- File Iterators.h ----------------------------*/
3/*--------------------------------------------------------------------------*/
92/*--------------------------------------------------------------------------*/
93/*----------------------------- DEFINITIONS --------------------------------*/
94/*--------------------------------------------------------------------------*/
95
96#ifndef __ADS_Iterators
97 #define __ADS_Iterators
98/* self-identification: #endif constant */
99
100/*--------------------------------------------------------------------------*/
101/*------------------------------ INCLUDES ----------------------------------*/
102/*--------------------------------------------------------------------------*/
103
104#include <compare>
105#include <cstddef>
106#include <iterator>
107#include <tuple>
108#include <type_traits>
109#include <utility>
110#include <vector>
111#include <version>
112#if defined( __cpp_lib_format_ranges )
113 #include <format>
114#endif
115
116/*--------------------------------------------------------------------------*/
117/*--------------------------- NAMESPACE ------------------------------------*/
118/*--------------------------------------------------------------------------*/
119
120namespace ADS
121{
122
123/*--------------------------------------------------------------------------*/
124/*------------------------- CLASS LinkedIterator ---------------------------*/
125/*--------------------------------------------------------------------------*/
126
129template< class C , class V , C * C::* Next , V C::* Value ,
130 bool Const = true >
132{
133 using Cell = std::conditional_t< Const , const C , C >;
134
135 public:
136 using iterator_category = std::forward_iterator_tag;
137 using value_type = V;
138 using difference_type = std::ptrdiff_t;
140 using reference = std::conditional_t< Const , const V & , V & >;
142 using pointer = std::conditional_t< Const , const V * , V * >;
143
145 LinkedIterator( void ) = default;
146
148 explicit LinkedIterator( Cell * c ) : f_c( c ) { }
149
151 template< bool K >
152 requires( Const && ! K )
155
157 reference operator*( void ) const { return( f_c->*Value ); }
158
160 pointer operator->( void ) const { return( &( f_c->*Value ) ); }
161
164 f_c = f_c->*Next;
165 return( *this );
166 }
167
170 auto t = *this;
171 ++*this;
172 return( t );
173 }
174
176 bool operator==( const LinkedIterator & o ) const = default;
177
179 [[nodiscard]] Cell * cell( void ) const { return( f_c ); }
180
181 private:
182 Cell * f_c = nullptr;
183
184 }; // end( class LinkedIterator )
185
186/*--------------------------------------------------------------------------*/
187/*-------------------------- CLASS IndexIterator ---------------------------*/
188/*--------------------------------------------------------------------------*/
189
192template< class C , class V , int C::* Next , V C::* Value ,
193 bool Const = true >
195{
196 using Cells =
197 std::conditional_t< Const , const std::vector< C > , std::vector< C > >;
198
199 public:
200 using iterator_category = std::forward_iterator_tag;
201 using value_type = V;
202 using difference_type = std::ptrdiff_t;
204 using reference = std::conditional_t< Const , const V & , V & >;
206 using pointer = std::conditional_t< Const , const V * , V * >;
207
209 IndexIterator( void ) = default;
210
212 IndexIterator( Cells * A , int c ) : f_A( A ) , f_c( c ) { }
213
215 template< bool K >
216 requires( Const && ! K )
218 : f_A( o.cells() ) , f_c( o.index() ) { }
219
221 reference operator*( void ) const { return( ( *f_A )[ f_c ].*Value ); }
222
224 pointer operator->( void ) const { return( &**this ); }
225
228 f_c = ( *f_A )[ f_c ].*Next;
229 return( *this );
230 }
231
234 auto t = *this;
235 ++*this;
236 return( t );
237 }
238
240 bool operator==( const IndexIterator & o ) const {
241 return( ( f_c == o.f_c ) && ( ( f_c < 0 ) || ( f_A == o.f_A ) ) );
242 }
243
245 [[nodiscard]] Cells * cells( void ) const { return( f_A ); }
246
248 [[nodiscard]] int index( void ) const { return( f_c ); }
249
250 private:
251 Cells * f_A = nullptr;
252 int f_c = -1;
253
254 }; // end( class IndexIterator )
255
256/*--------------------------------------------------------------------------*/
257/*------------------------ CLASS CircularIterator --------------------------*/
258/*--------------------------------------------------------------------------*/
259
263template< class T , bool Const = true >
265{
266 using Item = std::conditional_t< Const , const T , T >;
267
268 public:
270 using iterator_category = std::random_access_iterator_tag;
271 using value_type = T;
272 using difference_type = std::ptrdiff_t;
273 using reference = Item &;
274 using pointer = Item *;
275
277 CircularIterator( void ) = default;
278
280 CircularIterator( Item * A , std::size_t head , std::size_t capacity ,
282 : f_A( A ) , f_head( head ) , f_cap( capacity ) , f_i( i ) { }
283
285 template< bool K >
286 requires( Const && ! K )
288 : f_A( o.base() ) , f_head( o.head() ) , f_cap( o.capacity() ) ,
289 f_i( o.index() ) { }
290
292 reference operator*( void ) const { return( ( *this )[ 0 ] ); }
293
295 pointer operator->( void ) const { return( &**this ); }
296
300 return( f_A[ ( f_head + std::size_t( f_i + k ) ) % f_cap ] );
301 }
302
305 ++f_i;
306 return( *this );
307 }
308
311 --f_i;
312 return( *this );
313 }
314
317 auto t = *this;
318 ++f_i;
319 return( t );
320 }
321
324 auto t = *this;
325 --f_i;
326 return( t );
327 }
328
331 f_i += k;
332 return( *this );
333 }
334
337 f_i -= k;
338 return( *this );
339 }
340
342 return( a += k );
343 }
345 return( a += k );
346 }
348 return( a -= k );
349 }
351 const CircularIterator & b ) {
352 return( a.f_i - b.f_i );
353 }
354
356 bool operator==( const CircularIterator & o ) const {
357 return( f_i == o.f_i );
358 }
359
361 std::strong_ordering operator<=>( const CircularIterator & o ) const {
362 return( f_i <=> o.f_i );
363 }
364
366 [[nodiscard]] Item * base( void ) const { return( f_A ); }
367
369 [[nodiscard]] std::size_t head( void ) const { return( f_head ); }
370
372 [[nodiscard]] std::size_t capacity( void ) const { return( f_cap ); }
373
375 [[nodiscard]] difference_type index( void ) const { return( f_i ); }
376
377 private:
378 Item * f_A = nullptr;
379 std::size_t f_head = 0 , f_cap = 1;
380 difference_type f_i = 0;
381
382 }; // end( class CircularIterator )
383
384/*--------------------------------------------------------------------------*/
385/*-------------------------- CLASS RankIterator ----------------------------*/
386/*--------------------------------------------------------------------------*/
387
390template< class C , class T , bool Const = true >
392{
393 using Owner = std::conditional_t< Const , const C , C >;
394 using Item = std::conditional_t< Const , const T , T >;
395
396 public:
398 using iterator_category = std::random_access_iterator_tag;
399 using value_type = T;
400 using difference_type = std::ptrdiff_t;
401 using reference = Item &;
402 using pointer = Item *;
403
405 RankIterator( void ) = default;
406
408 RankIterator( Owner * c , std::size_t i ) : f_c( c ) , f_i( i ) { }
409
411 template< bool K >
412 requires( Const && ! K )
414 : f_c( o.owner() ) , f_i( o.rank() ) { }
415
417 reference operator*( void ) const { return( ( *f_c )[ f_i ] ); }
418
420 pointer operator->( void ) const { return( &**this ); }
421
424 return( ( *f_c )[ f_i + std::size_t( k ) ] );
425 }
426
429 ++f_i;
430 return( *this );
431 }
432
435 --f_i;
436 return( *this );
437 }
438
441 auto t = *this;
442 ++f_i;
443 return( t );
444 }
445
448 auto t = *this;
449 --f_i;
450 return( t );
451 }
452
455 f_i += std::size_t( k );
456 return( *this );
457 }
458
461 f_i -= std::size_t( k );
462 return( *this );
463 }
464
466 return( a += k );
467 }
469 return( a += k );
470 }
472 return( a -= k );
473 }
475 const RankIterator & b ) {
476 return( difference_type( a.f_i - b.f_i ) );
477 }
478
480 bool operator==( const RankIterator & o ) const { return( f_i == o.f_i ); }
481
483 std::strong_ordering operator<=>( const RankIterator & o ) const {
484 return( f_i <=> o.f_i );
485 }
486
488 [[nodiscard]] Owner * owner( void ) const { return( f_c ); }
489
491 [[nodiscard]] std::size_t rank( void ) const { return( f_i ); }
492
493 private:
494 Owner * f_c = nullptr;
495 std::size_t f_i = 0;
496
497 }; // end( class RankIterator )
498
499/*--------------------------------------------------------------------------*/
500/*------------------------ CLASS IndirectIterator --------------------------*/
501/*--------------------------------------------------------------------------*/
502
505template< std::random_access_iterator I >
507{
508 public:
510 using iterator_category = std::random_access_iterator_tag;
512 using value_type = std::remove_cvref_t< decltype( **std::declval< I >() ) >;
514 using difference_type = std::iter_difference_t< I >;
515 using reference = const value_type &;
516 using pointer = const value_type *;
517
519 IndirectIterator( void ) = default;
520
522 explicit IndirectIterator( I i ) : f_i( i ) { }
523
525 reference operator*( void ) const { return( **f_i ); }
526
528 pointer operator->( void ) const { return( &**f_i ); }
529
531 reference operator[]( difference_type k ) const { return( *f_i[ k ] ); }
532
535 ++f_i;
536 return( *this );
537 }
538
541 --f_i;
542 return( *this );
543 }
544
547 auto t = *this;
548 ++f_i;
549 return( t );
550 }
551
554 auto t = *this;
555 --f_i;
556 return( t );
557 }
558
561 f_i += k;
562 return( *this );
563 }
564
567 f_i -= k;
568 return( *this );
569 }
570
572 return( a += k );
573 }
575 return( a += k );
576 }
578 return( a -= k );
579 }
581 const IndirectIterator & b ) {
582 return( a.f_i - b.f_i );
583 }
584
586 bool operator==( const IndirectIterator & o ) const = default;
587
589 auto operator<=>( const IndirectIterator & o ) const = default;
590
592 [[nodiscard]] I base( void ) const { return( f_i ); }
593
594 private:
595 I f_i{};
596
597 }; // end( class IndirectIterator )
598
599/*--------------------------------------------------------------------------*/
600/*---------------------------- CLASS PairRef -------------------------------*/
601/*--------------------------------------------------------------------------*/
602
603namespace detail
604{
605
608template< class A , class B , class VA , class VB >
609class PairProxy : public std::pair< A , B >
610{
611 public:
613 using value_type = std::pair< VA , VB >;
614
615 using std::pair< A , B >::pair;
616
619 [[nodiscard]] operator value_type( void ) const {
620 return( value_type( VA( this->first ) , VB( this->second ) ) );
621 }
622
623 }; // end( class PairProxy )
624
628template< class A , class B , class VA , class VB >
629inline constexpr bool plainPair =
630#if defined( __cpp_lib_ranges_zip )
631 std::is_same_v< VA , std::remove_cvref_t< A > > &&
632 std::is_same_v< VB , std::remove_cvref_t< B > >;
633#else
634 false;
635#endif
636
637} // end( namespace detail )
638
646template< class A , class B , class VA = std::remove_cvref_t< A > ,
647 class VB = std::remove_cvref_t< B > >
648using PairRef =
649 std::conditional_t< detail::plainPair< A , B , VA , VB > ,
650 std::pair< A , B > ,
651 detail::PairProxy< A , B , VA , VB > >;
652
653namespace detail
654{
655
659template< class R >
660struct ItemValue
661{
662 using type = std::remove_cvref_t< R >;
663 };
664
665template< class A , class B , class VA , class VB >
666struct ItemValue< PairProxy< A , B , VA , VB > >
667{
668 using type = std::pair< VA , VB >;
669 };
670
671#if defined( __cpp_lib_ranges_zip )
672template< class A , class B >
673struct ItemValue< std::pair< A , B > >
674{
676 using type = std::pair< std::remove_cvref_t< A > , std::remove_cvref_t< B > >;
677 };
678#endif
679
680} // end( namespace detail )
681
682/*--------------------------------------------------------------------------*/
683/*-------------------------- CLASS SlotIterator ----------------------------*/
684/*--------------------------------------------------------------------------*/
685
689template< class O , class P >
691{
692 public:
694 using reference = decltype( P::read( std::declval< const O & >() , 0 ) );
696 using value_type = typename detail::ItemValue< reference >::type;
697 using difference_type = std::ptrdiff_t;
699 using iterator_concept = std::bidirectional_iterator_tag;
703 std::conditional_t< std::is_reference_v< reference > ,
704 std::bidirectional_iterator_tag ,
705 std::input_iterator_tag >;
706
708 SlotIterator( void ) = default;
709
711 SlotIterator( const O * o , std::size_t i ) : f_o( o ) ,
712 f_i( i ) { forward(); }
713
715 reference operator*( void ) const { return( P::read( *f_o , f_i ) ); }
716
730 ++f_i;
731 forward();
732 return( *this );
733 }
734
747 do
748 --f_i;
749 while( ! P::occupied( *f_o , f_i ) );
750 return( *this );
751 }
752
755 auto t = *this;
756 ++*this;
757 return( t );
758 }
759
762 auto t = *this;
763 --*this;
764 return( t );
765 }
766
768 bool operator==( const SlotIterator & o ) const { return( f_i == o.f_i ); }
769
771 [[nodiscard]] std::size_t place( void ) const { return( f_i ); }
772
773 private:
774 void forward( void ) {
775 const std::size_t m = P::size( *f_o );
776 while( ( f_i < m ) && ! P::occupied( *f_o , f_i ) )
777 ++f_i;
778 }
779
780 const O * f_o = nullptr;
781 std::size_t f_i = 0;
782
783 }; // end( class SlotIterator )
784
785/*--------------------------------------------------------------------------*/
786/*--------------------------- CLASS KeyIterator ----------------------------*/
787/*--------------------------------------------------------------------------*/
788
791template< std::forward_iterator I >
793{
794 public:
796 using reference =
797 const std::remove_cvref_t< decltype( ( *std::declval< I >() ).first ) > &;
798 using value_type = std::remove_cvref_t< reference >;
800 using difference_type = std::iter_difference_t< I >;
802 using iterator_concept = std::conditional_t< std::bidirectional_iterator< I > ,
803 std::bidirectional_iterator_tag ,
804 std::forward_iterator_tag >;
806
808 KeyIterator( void ) = default;
809
811 explicit KeyIterator( I i ) : f_i( i ) { }
812
814 reference operator*( void ) const { return( ( *f_i ).first ); }
815
817 const value_type * operator->( void ) const { return( &**this ); }
818
821 ++f_i;
822 return( *this );
823 }
824
827 auto t = *this;
828 ++f_i;
829 return( t );
830 }
831
834 requires std::bidirectional_iterator< I >
835 {
836 --f_i;
837 return( *this );
838 }
839
842 requires std::bidirectional_iterator< I >
843 {
844 auto t = *this;
845 --f_i;
846 return( t );
847 }
848
850 bool operator==( const KeyIterator & o ) const = default;
851
852 private:
853 I f_i{};
854
855 }; // end( class KeyIterator )
856
857/*--------------------------------------------------------------------------*/
858/*-------------------------- CLASS PathIterator ----------------------------*/
859/*--------------------------------------------------------------------------*/
860
865template< class O , class P >
867{
868 using N =
869 std::remove_pointer_t< decltype( P::root( std::declval< const O & >() ) ) >;
870
871 public:
873 using reference = decltype( P::read( std::declval< N * >() ) );
875 using value_type = typename detail::ItemValue< reference >::type;
876 using difference_type = std::ptrdiff_t;
878 using iterator_concept = std::bidirectional_iterator_tag;
882 std::conditional_t< std::is_reference_v< reference > ,
883 std::bidirectional_iterator_tag ,
884 std::input_iterator_tag >;
885
887 PathIterator( void ) = default;
888
890 PathIterator( const O * o , bool first ) : f_o( o ) {
891 if( first )
892 descend( P::root( *f_o ) , true );
893 }
894
896 reference operator*( void ) const { return( P::read( f_path.back() ) ); }
897
924 step( true );
925 return( *this );
926 }
927
943 if( f_path.empty() )
944 descend( P::root( *f_o ) , false );
945 else
946 step( false );
947 return( *this );
948 }
949
952 auto t = *this;
953 ++*this;
954 return( t );
955 }
956
959 auto t = *this;
960 --*this;
961 return( t );
962 }
963
965 bool operator==( const PathIterator & o ) const {
966 return( f_path.empty() ? o.f_path.empty()
967 : ( ! o.f_path.empty() &&
968 ( f_path.back() == o.f_path.back() ) ) );
969 }
970
971 private:
972 static N * child( N * n , bool right ) {
973 return( right ? P::right( n ) : P::left( n ) );
974 }
975
977 void descend( N * n , bool first ) {
978 for( ; n ; n = child( n , ! first ) )
979 f_path.push_back( n );
980 }
981
983 void step( bool forward ) {
984 if( N * c = child( f_path.back() , forward ) ) {
985 descend( c , forward );
986 return;
987 }
988 N * from; // up while coming from the
989 do { // side we move toward
990 from = f_path.back();
991 f_path.pop_back();
992 } while( ! f_path.empty() && ( child( f_path.back() , forward ) == from ) );
993 }
994
995 const O * f_o = nullptr;
996 std::vector< N * > f_path;
997
998 }; // end( class PathIterator )
999
1000/*--------------------------------------------------------------------------*/
1001/*-------------------------- CLASS WalkIterator ----------------------------*/
1002/*--------------------------------------------------------------------------*/
1003
1008template< class O , class H , class P >
1010{
1011 public:
1012 using value_type = H;
1013 using reference = H;
1014 using difference_type = std::ptrdiff_t;
1016 using iterator_concept = std::forward_iterator_tag;
1018 using iterator_category = std::input_iterator_tag;
1019
1021 WalkIterator( void ) = default;
1022
1024 WalkIterator( const O * o , H n , H root )
1025 : f_o( o ) , f_n( n ) , f_root( root ) { }
1026
1028 reference operator*( void ) const { return( f_n ); }
1029
1032 f_n = P::next( f_o , f_n , f_root );
1033 return( *this );
1034 }
1035
1038 auto t = *this;
1039 ++*this;
1040 return( t );
1041 }
1042
1044 bool operator==( const WalkIterator & o ) const { return( f_n == o.f_n ); }
1045
1046 private:
1047 const O * f_o = nullptr;
1048 H f_n = P::none;
1049 H f_root = P::none;
1050
1051 }; // end( class WalkIterator )
1052
1053/*--------------------------------------------------------------------------*/
1054
1055} // end( namespace ADS )
1056
1057/*--------------------------------------------------------------------------*/
1058/*------------------------ PairRef IN THE STANDARD -------------------------*/
1059/*--------------------------------------------------------------------------*/
1060
1064template< class A , class B , class VA , class VB ,
1065 template< class > class TQ ,
1066 template< class > class UQ >
1067struct std::basic_common_reference< ADS::detail::PairProxy< A , B , VA , VB > ,
1068 std::pair< VA , VB > , TQ , UQ >
1069{
1070 using type = ADS::detail::PairProxy< A , B , VA , VB >;
1071 };
1072
1074template< class A , class B , class VA , class VB ,
1075 template< class > class TQ ,
1076 template< class > class UQ >
1077struct std::basic_common_reference<
1078 std::pair< VA , VB > , ADS::detail::PairProxy< A , B , VA , VB > , TQ , UQ >
1079{
1080 using type = ADS::detail::PairProxy< A , B , VA , VB >;
1081 };
1082
1084template< class A , class B , class VA , class VB >
1085struct std::tuple_size< ADS::detail::PairProxy< A , B , VA , VB > >
1086 : std::integral_constant< std::size_t , 2 >
1087{ };
1088
1090template< std::size_t I , class A , class B , class VA , class VB >
1091struct std::tuple_element< I , ADS::detail::PairProxy< A , B , VA , VB > >
1092 : std::tuple_element< I , std::pair< A , B > >
1093{ };
1094
1095#if defined( __cpp_lib_format_ranges )
1097template< class A , class B , class VA , class VB , class C >
1098struct std::formatter< ADS::detail::PairProxy< A , B , VA , VB > , C >
1099 : std::formatter< std::pair< A , B > , C >
1100{ };
1101#endif
1103
1104/*--------------------------------------------------------------------------*/
1105
1106#endif /* Iterators.h included */
1107
1108/*--------------------------------------------------------------------------*/
1109/*-------------------------- End File Iterators.h --------------------------*/
1110/*--------------------------------------------------------------------------*/
bool operator==(const CircularIterator &o) const
equal on the same index from the head
Definition Iterators.h:356
CircularIterator(Item *A, std::size_t head, std::size_t capacity, difference_type i)
on the item from the head of the vector
Definition Iterators.h:280
friend CircularIterator operator-(CircularIterator a, difference_type k)
Definition Iterators.h:347
friend CircularIterator operator+(CircularIterator a, difference_type k)
Definition Iterators.h:341
friend difference_type operator-(const CircularIterator &a, const CircularIterator &b)
Definition Iterators.h:350
T value_type
the items
Definition Iterators.h:271
CircularIterator & operator+=(difference_type k)
items on
Definition Iterators.h:330
std::size_t head(void) const
the place of the first item
Definition Iterators.h:369
difference_type index(void) const
the index of the item from the head
Definition Iterators.h:375
CircularIterator operator++(int)
to the next item, returning the iterator before the step
Definition Iterators.h:316
reference operator[](difference_type k) const
the item places on, at the place
Definition Iterators.h:299
std::size_t capacity(void) const
the capacity of the vector
Definition Iterators.h:372
Item * base(void) const
the vector
Definition Iterators.h:366
std::ptrdiff_t difference_type
the distances
Definition Iterators.h:272
std::strong_ordering operator<=>(const CircularIterator &o) const
the order of the indices from the head
Definition Iterators.h:361
CircularIterator & operator++(void)
to the next item
Definition Iterators.h:304
Item & reference
a reference to an item
Definition Iterators.h:273
CircularIterator & operator-=(difference_type k)
items back
Definition Iterators.h:336
friend CircularIterator operator+(difference_type k, CircularIterator a)
Definition Iterators.h:344
CircularIterator(const CircularIterator< T, K > &o)
the constant iterator from the mutable one
Definition Iterators.h:287
std::random_access_iterator_tag iterator_category
random access
Definition Iterators.h:270
pointer operator->(void) const
the address of the item
Definition Iterators.h:295
Item * pointer
a pointer to an item
Definition Iterators.h:274
CircularIterator & operator--(void)
to the previous item
Definition Iterators.h:310
CircularIterator operator--(int)
to the previous item, returning the iterator before the step
Definition Iterators.h:323
CircularIterator(void)=default
an iterator on no vector
reference operator*(void) const
the item
Definition Iterators.h:292
IndexIterator operator++(int)
to the next cell, returning the iterator before the step
Definition Iterators.h:233
Cells * cells(void) const
Definition Iterators.h:245
IndexIterator & operator++(void)
to the next cell, by the index Next
Definition Iterators.h:227
bool operator==(const IndexIterator &o) const
equal on the same cell; any two ends are equal
Definition Iterators.h:240
std::ptrdiff_t difference_type
the distances
Definition Iterators.h:202
reference operator*(void) const
the item
Definition Iterators.h:221
std::conditional_t< Const, const V &, V & > reference
a reference to an item, constant if Const
Definition Iterators.h:204
std::forward_iterator_tag iterator_category
forward
Definition Iterators.h:200
IndexIterator(Cells *A, int c)
on the item of the cell , the end if
Definition Iterators.h:212
int index(void) const
Definition Iterators.h:248
IndexIterator(const IndexIterator< C, V, Next, Value, K > &o)
the constant iterator from the mutable one
Definition Iterators.h:217
IndexIterator(void)=default
the end
pointer operator->(void) const
the address of the item
Definition Iterators.h:224
std::conditional_t< Const, const V *, V * > pointer
a pointer to an item, constant if Const
Definition Iterators.h:206
V value_type
the items
Definition Iterators.h:201
friend IndirectIterator operator+(difference_type k, IndirectIterator a)
Definition Iterators.h:574
friend IndirectIterator operator+(IndirectIterator a, difference_type k)
Definition Iterators.h:571
IndirectIterator & operator-=(difference_type k)
pointers back
Definition Iterators.h:566
pointer operator->(void) const
the address of the item pointed to
Definition Iterators.h:528
IndirectIterator operator++(int)
to the next pointer, returning the iterator before the step
Definition Iterators.h:546
IndirectIterator & operator++(void)
to the next pointer
Definition Iterators.h:534
IndirectIterator & operator--(void)
to the previous pointer
Definition Iterators.h:540
std::random_access_iterator_tag iterator_category
random access
Definition Iterators.h:510
const value_type * pointer
a constant pointer to an item
Definition Iterators.h:516
reference operator*(void) const
the item pointed to
Definition Iterators.h:525
IndirectIterator operator--(int)
to the previous pointer, returning the iterator before the step
Definition Iterators.h:553
IndirectIterator(void)=default
an iterator on nothing
IndirectIterator & operator+=(difference_type k)
pointers on
Definition Iterators.h:560
const value_type & reference
a constant reference to an item
Definition Iterators.h:515
I base(void) const
the iterator on the pointers
Definition Iterators.h:592
std::iter_difference_t< I > difference_type
the distances, those of I
Definition Iterators.h:514
friend IndirectIterator operator-(IndirectIterator a, difference_type k)
Definition Iterators.h:577
friend difference_type operator-(const IndirectIterator &a, const IndirectIterator &b)
Definition Iterators.h:580
IndirectIterator(I i)
on the item pointed to by *i
Definition Iterators.h:522
bool operator==(const IndirectIterator &o) const =default
equal on the same pointer
reference operator[](difference_type k) const
the item pointed to places on
Definition Iterators.h:531
std::remove_cvref_t< decltype(**std::declval< I >()) > value_type
the items, those pointed to
Definition Iterators.h:512
auto operator<=>(const IndirectIterator &o) const =default
the order of the iterators on the pointers
bool operator==(const KeyIterator &o) const =default
equal when the iterators on the pairs are
const std::remove_cvref_t< decltype((*std::declval< I >()).first) > & reference
a constant reference to a key
Definition Iterators.h:796
KeyIterator & operator++(void)
to the next key
Definition Iterators.h:820
std::conditional_t< std::bidirectional_iterator< I >, std::bidirectional_iterator_tag, std::forward_iterator_tag > iterator_concept
bidirectional if I is, forward otherwise
Definition Iterators.h:802
std::remove_cvref_t< reference > value_type
the keys
Definition Iterators.h:798
KeyIterator operator++(int)
to the next key, returning the iterator before the step
Definition Iterators.h:826
std::iter_difference_t< I > difference_type
the distances, those of I
Definition Iterators.h:800
KeyIterator & operator--(void)
to the previous key
Definition Iterators.h:833
KeyIterator(void)=default
an iterator on nothing
reference operator*(void) const
the key
Definition Iterators.h:814
iterator_concept iterator_category
as iterator_concept
Definition Iterators.h:805
KeyIterator(I i)
on the key of what i reads
Definition Iterators.h:811
const value_type * operator->(void) const
the address of the key
Definition Iterators.h:817
KeyIterator operator--(int)
to the previous key, returning the iterator before the step
Definition Iterators.h:841
Cell * cell(void) const
Definition Iterators.h:179
V value_type
the items
Definition Iterators.h:137
std::conditional_t< Const, const V &, V & > reference
a reference to an item, constant if Const
Definition Iterators.h:140
std::ptrdiff_t difference_type
the distances
Definition Iterators.h:138
LinkedIterator(Cell *c)
on the item of the cell , the end if is nil
Definition Iterators.h:148
LinkedIterator(void)=default
the end
std::conditional_t< Const, const V *, V * > pointer
a pointer to an item, constant if Const
Definition Iterators.h:142
LinkedIterator(const LinkedIterator< C, V, Next, Value, K > &o)
the constant iterator from the mutable one
Definition Iterators.h:153
std::forward_iterator_tag iterator_category
forward
Definition Iterators.h:136
LinkedIterator & operator++(void)
to the next cell, by the link Next
Definition Iterators.h:163
LinkedIterator operator++(int)
to the next cell, returning the iterator before the step
Definition Iterators.h:169
pointer operator->(void) const
the address of the item
Definition Iterators.h:160
reference operator*(void) const
the item
Definition Iterators.h:157
bool operator==(const LinkedIterator &o) const =default
equal on the same cell
PathIterator & operator--(void)
to the previous node in symmetric order, from the end to the last node
Definition Iterators.h:942
std::conditional_t< std::is_reference_v< reference >, std::bidirectional_iterator_tag, std::input_iterator_tag > iterator_category
bidirectional for the older algorithms if P::read() gives a reference, input otherwise
Definition Iterators.h:881
PathIterator operator++(int)
to the next node, returning the iterator before the step
Definition Iterators.h:951
decltype(P::read(std::declval< N * >())) reference
what P::read() gives
Definition Iterators.h:873
PathIterator & operator++(void)
to the next node in symmetric order, amortized over a whole visit and at most
Definition Iterators.h:923
PathIterator operator--(int)
to the previous node, returning the iterator before the step
Definition Iterators.h:958
PathIterator(const O *o, bool first)
on the first node of the tree of o if first, at the end otherwise
Definition Iterators.h:890
std::bidirectional_iterator_tag iterator_concept
bidirectional for the concepts of C++20
Definition Iterators.h:878
PathIterator(void)=default
the end of no tree
bool operator==(const PathIterator &o) const
equal on the same node, or both at the end
Definition Iterators.h:965
typename detail::ItemValue< reference >::type value_type
the items, the pair of the copies for a PairRef
Definition Iterators.h:875
reference operator*(void) const
the item of the current node, read by P::read()
Definition Iterators.h:896
std::ptrdiff_t difference_type
the distances
Definition Iterators.h:876
friend RankIterator operator+(RankIterator a, difference_type k)
Definition Iterators.h:465
RankIterator operator--(int)
to the previous item, returning the iterator before the step
Definition Iterators.h:447
RankIterator(void)=default
an iterator on no container
std::strong_ordering operator<=>(const RankIterator &o) const
the order of the ranks
Definition Iterators.h:483
RankIterator(Owner *c, std::size_t i)
on the item of rank of c
Definition Iterators.h:408
RankIterator operator++(int)
to the next item, returning the iterator before the step
Definition Iterators.h:440
Item & reference
a reference to an item
Definition Iterators.h:401
reference operator[](difference_type k) const
the item ranks on
Definition Iterators.h:423
reference operator*(void) const
the item
Definition Iterators.h:417
bool operator==(const RankIterator &o) const
equal on the same rank
Definition Iterators.h:480
T value_type
the items
Definition Iterators.h:399
Item * pointer
a pointer to an item
Definition Iterators.h:402
Owner * owner(void) const
Definition Iterators.h:488
RankIterator(const RankIterator< C, T, K > &o)
the constant iterator from the mutable one
Definition Iterators.h:413
friend RankIterator operator+(difference_type k, RankIterator a)
Definition Iterators.h:468
pointer operator->(void) const
the address of the item
Definition Iterators.h:420
RankIterator & operator++(void)
to the next item
Definition Iterators.h:428
std::random_access_iterator_tag iterator_category
random access
Definition Iterators.h:398
RankIterator & operator-=(difference_type k)
items back
Definition Iterators.h:460
friend RankIterator operator-(RankIterator a, difference_type k)
Definition Iterators.h:471
std::size_t rank(void) const
Definition Iterators.h:491
friend difference_type operator-(const RankIterator &a, const RankIterator &b)
Definition Iterators.h:474
RankIterator & operator+=(difference_type k)
items on
Definition Iterators.h:454
RankIterator & operator--(void)
to the previous item
Definition Iterators.h:434
std::ptrdiff_t difference_type
the distances
Definition Iterators.h:400
std::conditional_t< std::is_reference_v< reference >, std::bidirectional_iterator_tag, std::input_iterator_tag > iterator_category
Definition Iterators.h:702
std::bidirectional_iterator_tag iterator_concept
Definition Iterators.h:699
decltype(Places::read(std::declval< const BucketCuckooTable & >(), 0)) reference
Definition Iterators.h:694
std::ptrdiff_t difference_type
Definition Iterators.h:697
std::size_t place(void) const
the place
Definition Iterators.h:771
SlotIterator operator--(int)
to the previous occupied place, returning the iterator before the step
Definition Iterators.h:761
SlotIterator operator++(int)
to the next occupied place, returning the iterator before the step
Definition Iterators.h:754
SlotIterator & operator--(void)
to the previous occupied place
Definition Iterators.h:746
typename detail::ItemValue< reference >::type value_type
Definition Iterators.h:696
SlotIterator & operator++(void)
to the next occupied place, or to the end
Definition Iterators.h:729
SlotIterator(const O *o, std::size_t i)
on the first occupied place from , or at the end
Definition Iterators.h:711
SlotIterator(void)=default
an iterator on no table
reference operator*(void) const
the item of the place, read by P::read()
Definition Iterators.h:715
bool operator==(const SlotIterator &o) const
equal on the same place
Definition Iterators.h:768
WalkIterator operator++(int)
to the next node, returning the iterator before the step
Definition Iterators.h:1037
WalkIterator & operator++(void)
to the next node of the walk, P::next( o , n , root )
Definition Iterators.h:1031
H reference
a node, by value
Definition Iterators.h:1013
std::input_iterator_tag iterator_category
input for the older algorithms, since *it is a value
Definition Iterators.h:1018
WalkIterator(void)=default
the end
WalkIterator(const O *o, H n, H root)
on the node n of the walk below root of the owner o
Definition Iterators.h:1024
bool operator==(const WalkIterator &o) const
equal on the same node
Definition Iterators.h:1044
std::ptrdiff_t difference_type
the distances
Definition Iterators.h:1014
H value_type
the nodes
Definition Iterators.h:1012
std::forward_iterator_tag iterator_concept
forward for the concepts of C++20
Definition Iterators.h:1016
reference operator*(void) const
the node
Definition Iterators.h:1028
std::conditional_t< detail::plainPair< A, B, VA, VB >, std::pair< A, B >, detail::PairProxy< A, B, VA, VB > > PairRef
the pair that an iterator reads by value, in general two references into the container,...
Definition Iterators.h:648
GrB_Type type(void)
the type of GraphBLAS of the numbers T: GrB_BOOL, the integers of 8 to 64 bits with or without sign,...
Definition GraphBLAS.h:128
Definition ADT.h:96