|
Boost Users : |
From: Dave Steffen (dgsteffen_at_[hidden])
Date: 2005-05-10 17:52:34
Thanks very much for all your replies.
I wrote
> However, for maps, the second variation (declaring outside the macro)
> doesn't work:
>
> map<int,int> m;
> ...
> FOREACH (map<int,int>::value_type i, m) {...} // compiles
> map<int,int>::value_type i;
> FOREACH (i, m) {...} // COMPILE ERROR
>
And the various replies are right on the money, and appreciated. I
thought it was something like this, but I couldn't quite figure out
what was going on.
If anyone's interested: I'm playing with the idea of extending FOREACH
in a way so that, instead of having a pair<>, you've got two separate
variables for key and value. Maybe something like:
map<int,int> m;
...
FOREACH_PAIR(int key, int value, m)
{ ... }
I'm having a very moderate amount of success. Anyone else playing
with this sort of thing?
Thanks again!
----------------------------------------------------------------------
Dave Steffen, Ph.D. "The only justification for our concepts and
Software Engineer IV systems of concepts is that they serve to
Numerica Corporation represent the complex of our experiences;
ph (970) 419-8343 x27 beyond this they have no legitimacy."
fax (970) 223-6797 -- Albert Einstein
dgsteffen_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net