Hello,
I am struggling making for_each work right. I am using Sourcery
targeting ARM. AFAIK, GCC is actually 4.7.2, and I am flagging
-std=c++11.
I'm not really picky how we get for_each done (or constructs like it).
I'd like to avoid "macro-expansion" for obvious reasons (i.e. debug),
and the always-infamous verbosity of a for loop, if possible.
I've got the following:
vector all;
rgb_type rgb;
rgb_type rgb2 = rgb.clone();
for_each(all.begin(), all.end(), cout << _1->r() << endl);
With errors:
_1 was not declared in this scope. (C++ Problem)
That or,
void rgb_printer_func(rgb_type* prgb) {
cout << prgb->r() << endl;
}
for_each(all.begin(), all.end(), rgb_printer_func);
With errors:
Invalid arguments Candidates are: #1 for_each(#0, #0, #1) (Semantic Error)
Thank you.
Regards,
Michael Powell