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

Class iterator

src/fl/stl/unordered_map_small.h:44–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42
43 // Forward iterator that skips unoccupied slots.
44 struct iterator {
45 using reference = value_type&;
46 using pointer = value_type*;
47 using iterator_category = fl::forward_iterator_tag;
48
49 iterator() FL_NOEXCEPT : mMap(nullptr), mIdx(0) {}
50 iterator(unordered_map_small* map, size_type idx) FL_NOEXCEPT
51 : mMap(map), mIdx(idx) { advance_to_occupied(); }
52
53 reference operator*() const FL_NOEXCEPT { return mMap->mData[mIdx]; }
54 pointer operator->() const FL_NOEXCEPT { return &mMap->mData[mIdx]; }
55
56 iterator& operator++() FL_NOEXCEPT { ++mIdx; advance_to_occupied(); return *this; }
57 iterator operator++(int) FL_NOEXCEPT { iterator t = *this; ++(*this); return t; }
58
59 bool operator==(const iterator& o) const FL_NOEXCEPT { return mIdx == o.mIdx; }
60 bool operator!=(const iterator& o) const FL_NOEXCEPT { return mIdx != o.mIdx; }
61
62 private:
63 void advance_to_occupied() FL_NOEXCEPT {
64 if (!mMap) return;
65 size_type cap = mMap->mData.size();
66 while (mIdx < cap && !mMap->mOccupied.test(mIdx)) ++mIdx;
67 }
68 unordered_map_small* mMap;
69 size_type mIdx;
70 friend class unordered_map_small;
71 };
72
73 struct const_iterator {
74 using reference = const value_type&;

Callers 4

unordered_map_smallClass · 0.70
findMethod · 0.70
insertMethod · 0.70
insert_or_updateMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected