Boost logo

Boost Users :

From: Kirit Sælensminde (kirit.saelensminde_at_[hidden])
Date: 2007-07-10 00:21:34


Maciek Godek wrote:
> function<void (int, int)> f =
> if_(_1 == _2) [
> cout << cref("arguments are equal\n")
> ].else_[
> cout << cref("arguments differ\n")
> ];
>
> f(1, 1);
> f(1, 2);
> }
> On g++ 3.3.4 I got a (scarcely readable) error that std::ios_base copy
> constructor is private (the more recent compiler gave much more trashy
> output, but I've infered that the reason is probably the same).

I think you need to surround the cout with boost::ref, i.e. boost::ref(
cout ). The lambda takes a copy of its argument, and you want to make
sure that it uses the reference instead.

K


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net