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

Class iterator

src/fl/stl/basic_string.h:63–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 };
62
63 class iterator {
64 private:
65 char* ptr;
66 public:
67 typedef char value_type;
68 typedef char& reference;
69 typedef char* pointer;
70 typedef fl::ptrdiff_t difference_type;
71 typedef fl::random_access_iterator_tag iterator_category;
72
73 iterator() FL_NOEXCEPT : ptr(nullptr) {}
74 explicit iterator(char* p) FL_NOEXCEPT : ptr(p) {}
75
76 reference operator*() const FL_NOEXCEPT { return *ptr; }
77 pointer operator->() const FL_NOEXCEPT { return ptr; }
78 iterator& operator++() FL_NOEXCEPT { ++ptr; return *this; }
79 iterator operator++(int) FL_NOEXCEPT { iterator tmp = *this; ++ptr; return tmp; }
80 iterator& operator--() FL_NOEXCEPT { --ptr; return *this; }
81 iterator operator--(int) FL_NOEXCEPT { iterator tmp = *this; --ptr; return tmp; }
82
83 iterator operator+(difference_type n) const FL_NOEXCEPT { return iterator(ptr + n); }
84 iterator operator-(difference_type n) const FL_NOEXCEPT { return iterator(ptr - n); }
85 iterator& operator+=(difference_type n) FL_NOEXCEPT { ptr += n; return *this; }
86 iterator& operator-=(difference_type n) FL_NOEXCEPT { ptr -= n; return *this; }
87 difference_type operator-(const iterator& other) const FL_NOEXCEPT { return ptr - other.ptr; }
88 reference operator[](difference_type n) const FL_NOEXCEPT { return ptr[n]; }
89
90 bool operator==(const iterator& other) const FL_NOEXCEPT { return ptr == other.ptr; }
91 bool operator!=(const iterator& other) const FL_NOEXCEPT { return ptr != other.ptr; }
92 bool operator<(const iterator& other) const FL_NOEXCEPT { return ptr < other.ptr; }
93 bool operator>(const iterator& other) const FL_NOEXCEPT { return ptr > other.ptr; }
94 bool operator<=(const iterator& other) const FL_NOEXCEPT { return ptr <= other.ptr; }
95 bool operator>=(const iterator& other) const FL_NOEXCEPT { return ptr >= other.ptr; }
96
97 operator char*() const FL_NOEXCEPT { return ptr; }
98 };
99
100 class const_iterator {
101 private:

Callers 3

operator+Method · 0.70
operator-Method · 0.70
basic_stringClass · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected