diff --git a/api/sixtyfps-cpp/include/sixtyfps_interpreter.h b/api/sixtyfps-cpp/include/sixtyfps_interpreter.h index 10b1a1390..834c71d47 100644 --- a/api/sixtyfps-cpp/include/sixtyfps_interpreter.h +++ b/api/sixtyfps-cpp/include/sixtyfps_interpreter.h @@ -151,6 +151,8 @@ public: /// ``` struct iterator { + /// A typedef for std::pair that's returned + /// when dereferencing the iterator. using value_type = std::pair; private: @@ -182,16 +184,23 @@ public: // FIXME i believe iterator are supposed to be copy constructible iterator(const iterator &) = delete; iterator &operator=(const iterator &) = delete; - iterator(iterator &&) = default; - iterator &operator=(iterator &&) = default; + /// Move-constructs a new iterator from \a other. + iterator(iterator &&other) = default; + /// Move-assigns the iterator \a other to this and returns a reference to this. + iterator &operator=(iterator &&other) = default; + /// The prefix ++ operator advances the iterator to the next entry and returns + /// a reference to this. iterator &operator++() { if (v) next(); return *this; } + /// Dereferences the iterator to return a pair of the key and value. value_type operator*() const { return { k, *v }; } + /// Returns true if \a a is pointing to the same entry as \a b; false otherwise. friend bool operator==(const iterator &a, const iterator &b) { return a.v == b.v; } + /// Returns false if \a a is pointing to the same entry as \a b; true otherwise. friend bool operator!=(const iterator &a, const iterator &b) { return a.v != b.v; } };