I have a class which I want to expose a list of structs (which just contain some integers). I don\'t want the outside to modify these data, just iterate over it and read the
If your collection type presents a standard container interface, you don't need to do anything to make
BOOST_FOREACH
work with your type. In other words, if your type hasiterator
andconst_iterator
nested typedefs, andbegin()
andend()
member functions,BOOST_FOREACH
already knows how to iterate over your type. No further action is required.
http://boost-sandbox.sourceforge.net/libs/foreach/doc/html/boost_foreach/extending_boost_foreach.html