slint::interpreter::Struct::iterator Struct
struct iterator;#include <slint-interpreter.h>The Struct::iterator class implements the typical C++ iterator protocol and conveniently provides access to the field names and values of a Struct. It is created by calling either Struct::begin() or Struct::end().
Make sure to compare the iterator to the iterator returned by Struct::end() before de-referencing it. The value returned when de-referencing is a std::pair ↗ that holds a std::string_view ↗ of the field name as well as a const reference of the value. Both references become invalid when the iterator or the Struct is changed, so make sure to make copies if you want to retain the name or value.
Note that the order in which the iterator exposes the fields is not defined.
If you’re using C++ 17, you can use the convenience destructuring syntax to extract the name and value in one go:
Struct stru = ...;auto it = stru.begin();...++it; // advance iterator to the next field...// Check iterator before dereferencing itif (it != stru.end()) { // Extract a view of the name and a const reference to the value in one go. auto [field_name, field_value] = *it;}Public Types
Section titled “Public Types” value_type
Section titled “ value_type”std::pair< std::string_view, const Value & > using slint::interpreter::Struct::iterator::value_type = std::pair<std::string_view, const Value &>
A typedef for std::pair<std::string_view, const Value &> that’s returned when dereferencing the iterator.
Public Functions
Section titled “Public Functions” ~iterator
Section titled “ ~iterator”slint::interpreter::Struct::iterator::~iterator()
Destroys this field iterator.
iterator
Section titled “ iterator”slint::interpreter::Struct::iterator::iterator(const iterator &)=delete
operator=
Section titled “ operator=”iterator & slint::interpreter::Struct::iterator::operator=(const iterator &)=delete
iterator
Section titled “ iterator”slint::interpreter::Struct::iterator::iterator(iterator &&other)=default
Move-constructs a new iterator from other.
operator=
Section titled “ operator=”iterator & slint::interpreter::Struct::iterator::operator=(iterator &&other)=default
Move-assigns the iterator other to this and returns a reference to this.
operator++
Section titled “ operator++”iterator & slint::interpreter::Struct::iterator::operator++()
The prefix ++ operator advances the iterator to the next entry and returns a reference to this.
operator*
Section titled “ operator*”value_type slint::interpreter::Struct::iterator::operator*() const
Dereferences the iterator to return a pair of the key and value.
Friends
Section titled “Friends” operator==
Section titled “ operator==”bool operator==(const iterator &a, const iterator &b)
Returns true if a is pointing to the same entry as b; false otherwise.
operator!=
Section titled “ operator!=”bool operator!=(const iterator &a, const iterator &b)
Returns false if a is pointing to the same entry as b; true otherwise.
© 2026 SixtyFPS GmbH