
On Thu, Oct 2, 2008 at 11:51 AM, Franz Alt <f.alt@gmx.net> wrote:
Robert Jones schrieb:
On Thu, Oct 2, 2008 at 11:12 AM, Peter Barker <newbarker@gmail.com> wrote:
Hello,
Here's an example of my problem:
#include <algorithm> #include <vector>
#include <boost/bind.hpp>
class TheClass { };
void accept(TheClass& tc) { }
int main() { std::vector<TheClass*> cont;
// Compile error - how to dereference _1 ??? std::for_each(cont.begin(),cont.end(),boost::bind(&accept,_1)); }
How can I dereference _1 so I can use the accept function?
#include <algorithm> #include <vector>
#include <boost/lambda/bind.hpp> #include <boost/lambda/lambda.hpp>
class TheClass { };
void accept(TheClass& tc) { }
int main() { using namespace boost; using namespace boost::lambda;
std::vector<TheClass*> cont;
// Compile error - how to dereference _1 ??? std::for_each(cont.begin(),cont.end(),bind(accept,*_1)); }
- Rob. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Rob,
with
std::for_each(cont.begin(),cont.end(),bind(&accept,*_1));
you can dereference _1.
Best regards
Franz
Franz, I think that gave an illegal indirection compiler error. Regards, Pete