|
Boost Users : |
From: David Brownell (david_brownell_at_[hidden])
Date: 2002-03-26 20:18:20
I have a hunch that this has been asked before, but I can't seem to find
the answer. I have a struct similar to:
struct MyStruct
{
int i;
char c;
};
And a functor similar to:
struct MyFunctor
{
void operator()(int i)
{
//Do something with i
}
};
Given a container of MyStruct objects, how can I use iterator_adaptor to
use MyStruct::i with MyFunctor? Something like:
std::vector<MyStruct> v;
std::for_each(v.begin(), v.end(), MyFunctor());
I have overridden the dereference method in default_iterator_policies to
return the integer, but am at a bit of a loss where to go from here.
Am I on the right track?
TIA for your help!
David Brownell
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