What is the correct way to replace this:
std::ostringstream buf;
std::for_each(bd.begin(), bd.end(), buf << boost::lambda::constant(" ") << boost::lambda::_1);
With an implementation that doesn't use boost? This is what I've tried:
std::string backspace("&nbps;");
std::ostringstream buf;
std::for_each(bd.begin(), bd.end(), buf << backspace << std::placeholders::_1);
The second '<<' is underlined in red and I get the error message:
error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::_Ph<1>' (or there is no acceptable conversion)
boost::lambda
is a marvellous monstrosity that kind of backported lambdas to C++03. The equivalent to your code is:
std::ostringstream buf;
std::for_each(bd.begin(), bd.end(), [&](auto const &v) { buf << " " << v; });
... or even:
std::ostringstream buf;
for(auto const &v : bd)
buf << " " << v;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With