10 Jul
2007
10 Jul
'07
4:21 a.m.
Maciek Godek wrote:
function
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