9 Sep
2011
9 Sep
'11
2:04 p.m.
----- "Szymon Gatner"
Hi,
Is there a way of automatic placeholder argument dereferencing when using bind()? I mean:
struct SomePredicate { bool operator()(int num, const Foo& foo) const { return SomeTestOnFoo(num, foo); } }
std::vector
foos; // line below gives compilation error because second argument passed // to functor is Foo* and not Foo.
std::for_each(foos.begin(), foos.end(), bind(SomePredicate(), 123, _1);
From http://www.boost.org/doc/libs/1_47_0/doc/html/lambda/le_in_details.html#id21... (section "Sizeof and typeid")
for_each(a.begin(), a.end(), cout << bind(&type_info::name, ll_typeid(*_1))); Have you tried *_1 ? Regards, Ivan