Next: , Previous: The library_base class, Up: Library framework



5.3.2 The library_base::const_iterator class

In the terminology of the STL, the library_entry::const_iterator class is an Input Iterator but not a Forward Iterator. This means that multiple iterators on the same library will not work as expected.

— Constructor: library_base::const_iterator::const_iterator (void);

This is the default constructor. It is undefined behaviour to dereference or increment the default constructed library_base::const_iterator.

— Constructor: library_base::const_iterator::const_iterator (library_base* lb, library_entry::impl* val);

This constructor creates an iterator on library lb and with a library entry implementation of val. The constructor takes ownership of val, which must have been allocated using new; it does not take ownership of lb. Typically, this function should only be called by the begin function of classes derived from library_base.

— Function: bool library_base::const_iterator::operator== (const library_base::const_iterator& other) const;
— Function: bool library_base::const_iterator::operator!= (const library_base::const_iterator& other) const;

Compare two iterators. It is undefined behaviour to compare two iterators from different libraries.

— Function: library_entry library_base::const_iterator::operator* (void) const;
— Function: library_entry* library_base::const_iterator::operator-> (void) const;

Dereferences an iterator to retrieve the current library_entry. It is undefined behaviour to dereference an iterator that compares equal to the end iterator of that library.

— Function: library_base::const_iterator& library_base::const_iterator::operator++ (void) const;
— Function: library_base::const_iterator library_base::const_iterator::operator++ (int) const;

The prefix and postfix increment operators move the iterator on to point to the next entry in the library. If there are no further entries in the library, the iterator will compare equal to the library's end iterator.