Has anyone tried providing support for Iterator in C. I am not looking for exact C++ STL::Iterator but minimal support for some idea to start would be good point for me .
I am developing container library same like stl but with minimal support, So I need this kind of functionality in those container.
I am looking forward of defining certain sets of algorithms interfaces ( similar to STL ). For example sort , which will take begin and end iterator and should work with any container.
If you are allowed to use LGPL code in your project have a look at GLib instead of re-inventing the wheel. GLib allows also to develop in a quite portable way at source code level.
Have a look at g_list_first()
and g_list_next()
which implement the functionality of an iterator on the list. There is even a g_list_foreach()`
http://library.gnome.org/devel/glib/stable/glib-Doubly-Linked-Lists.html