
Hello, I've two problems so far with a simple for_each: 1. vector<string*> v2(10); fill(v2.begin(), v2.end(), new string("hehe")); for_each(v2.begin(), v2.end(), cout << *_1 << " "); // works for_each(v2.begin(), v2.end(), delete _1 ); // error // error: type ‘const struct // boost::lambda::lambda_functor<boost::lambda::placeholder<1> // >’ argument given to ‘delete’, expected pointer Shouldn't the placeholder _1 actually become a (string-)pointer as it obviously does in the expression above ( cout << *_1 << " " )? 2. Is it possible to call member functions from an placeholder of a boost-like lambda expression? vector<string> v3(10); fill(v3.begin(), v3.end(), "hoho"); for_each(v3.begin(), v3.end(), cout << _1->c_str() << " "); // error // error: base operand of ‘->’ has non-pointer type ‘const // boost::lambda::lambda_functor<boost::lambda::placeholder<1> >’ Thank you for any input!