
20 Sep
2009
20 Sep
'09
2:56 p.m.
Chris Purcell wrote:
After a pointer in the right direction from Dan Marsden, I've generalized the macro to Boost.Fusion-compatible types. The syntax is as follows:
std::map<int, int> my_map; BOOST_FOREACH_FIELD((int key)(int value), my_map) std::cout << key << " : " << value << "\n";
std::vector<boost::fusion::vector<int, std::string, int> > my_complex_type; BOOST_FOREACH_FIELD((int i)(std::string const& j)(int& k), my_complex_type) std::cout << "line: " << i << ", " << j << ", " << ++k; <snip>
Huh, interesting. Please open a feature request ticket at svn.boost.org, and I'll consider adding this. -- Eric Niebler BoostPro Computing http://www.boostpro.com