$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [bind] How do I....?
From: Björn Karlsson (Bjorn.Karlsson_at_[hidden])
Date: 2009-08-18 06:01:47
Hello Neil,
> Two tactics spring to mind.
>
> One is to use boost::make_indirect_iterator on v.begin() and v.end()
> and just pass in f instead of the boost::bind(...).
Yes, this makes for quite readable code:
for_each(make_indirect_iterator(vec.begin()), make_indirect_iterator(vec.end()), &foo);
> The other is to use RangeEx (shameless plug) thus:
>
> using namespace boost::adaptors;
> boost::for_each(v | indirected, f);
>
Creative! A good example of why it helps to have many power tools!
Cheers,
Bjorn Karlsson
www.skeletonsoftware.net