|
Boost : |
Subject: Re: [boost] [Foreach] Proposal to simplify using Boost.Foreach withmaps
From: Eric Niebler (eric_at_[hidden])
Date: 2009-09-20 10:56:01
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk