Next: , Previous: library constructors, Up: The library class



5.1.2.3 Iteration functions

The library class has an associated iterator class.

— Data type: library::const_iterator;

In the language of the Standard Template Library, this is an input iterator. This means that you may only use it to read methods from the library in order, starting at the beginning. The value type of the iterator is library_entry see The library_entry class.

— Function: library::const_iterator library::begin (void) const;
— Function: library::const_iterator library::end (void) const;

These functions return iterators pointing to the beginning and end of the library, respectively.

This is how these functions may be used to iterate through the library:

     // Open a library
     library l("my_library.xml");
     library::const_iterator i;
     
     // Print the base name of each method in it
     for(i = l.begin(); i != l.end(); ++i)
       cout << i->base_name() << endl;