MCPcopy Create free account
hub / github.com/LibRapid/librapid / ArrayIterator

Class ArrayIterator

librapid/include/librapid/array/arrayIterator.hpp:6–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4namespace librapid::detail {
5 template<typename T>
6 class ArrayIterator {
7 public:
8 using IndexType = size_t;
9
10 /// Default constructor should never be used
11 ArrayIterator() = delete;
12
13 explicit LIBRAPID_ALWAYS_INLINE ArrayIterator(const T &array);
14
15 explicit LIBRAPID_ALWAYS_INLINE ArrayIterator(const T &array, IndexType index);
16
17 explicit LIBRAPID_ALWAYS_INLINE ArrayIterator(T &&array, IndexType index);
18
19 /// Copy an ArrayIterator object (const)
20 /// \param other The array to copy
21 LIBRAPID_ALWAYS_INLINE ArrayIterator(const ArrayIterator &other) = default;
22
23 /// Constructs an ArrayIterator from a temporary instance
24 /// \param other The ArrayIterator to move
25 LIBRAPID_ALWAYS_INLINE ArrayIterator(ArrayIterator &&other) = default;
26
27 /// Assigns another ArrayIterator object to this ArrayIterator.
28 /// \param other The ArrayIterator to assign.
29 /// \return A reference to this
30 LIBRAPID_ALWAYS_INLINE ArrayIterator &operator=(const ArrayIterator &other) = default;
31
32 LIBRAPID_ALWAYS_INLINE ArrayIterator &operator++();
33 LIBRAPID_ALWAYS_INLINE bool operator==(const ArrayIterator<T> &other) const;
34 LIBRAPID_ALWAYS_INLINE bool operator!=(const ArrayIterator<T> &other) const;
35
36 LIBRAPID_ALWAYS_INLINE auto operator*() const;
37 LIBRAPID_ALWAYS_INLINE auto operator*();
38
39 LIBRAPID_ALWAYS_INLINE ArrayIterator<ArrayIterator<T>> begin() const noexcept;
40 LIBRAPID_ALWAYS_INLINE ArrayIterator<ArrayIterator<T>> end() const noexcept;
41
42 LIBRAPID_ALWAYS_INLINE ArrayIterator<ArrayIterator<T>> begin();
43 LIBRAPID_ALWAYS_INLINE ArrayIterator<ArrayIterator<T>> end();
44
45 private:
46 T m_array;
47 IndexType m_index;
48 };
49
50 template<typename T>
51 LIBRAPID_ALWAYS_INLINE ArrayIterator<T>::ArrayIterator(const T &array) :

Callers 2

beginMethod · 0.85
endMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected