MCPcopy Create free account
hub / github.com/FastLED/FastLED / iterator

Class iterator

src/fl/gfx/corkscrew.h:88–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87 // Iterator class moved from CorkscrewState
88 class iterator {
89 public:
90 using value_type = vec2f;
91 using difference_type = fl::i32;
92 using pointer = vec2f *;
93 using reference = vec2f &;
94 using iterator_category = fl::bidirectional_iterator_tag;
95
96 iterator(const Corkscrew *corkscrew, fl::size position)
97 : mCorkscrew(corkscrew), mPosition(position) {}
98
99 vec2f operator*() const;
100
101 iterator &operator++() {
102 ++mPosition;
103 return *this;
104 }
105
106 iterator operator++(int) {
107 iterator temp = *this;
108 ++mPosition;
109 return temp;
110 }
111
112 iterator &operator--() {
113 --mPosition;
114 return *this;
115 }
116
117 iterator operator--(int) {
118 iterator temp = *this;
119 --mPosition;
120 return temp;
121 }
122
123 bool operator==(const iterator &other) const {
124 return mPosition == other.mPosition;
125 }
126
127 bool operator!=(const iterator &other) const {
128 return mPosition != other.mPosition;
129 }
130
131 difference_type operator-(const iterator &other) const {
132 return static_cast<difference_type>(mPosition) -
133 static_cast<difference_type>(other.mPosition);
134 }
135
136 private:
137 const Corkscrew *mCorkscrew;
138 fl::size mPosition;
139 };
140
141 // Constructors that integrate input parameters directly
142 // Primary constructor with default values for invert and gapParams

Callers 2

beginMethod · 0.70
endMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected