Boost logo

Boost Users :

From: Maciek Godek (pstrychuj_at_[hidden])
Date: 2007-07-09 14:54:28


Hi,
I've tried to compile the following code on linux/g++ (version 3.3.4
and 4.1.2), boost version 1.34:

-- CODE BEGINS --

#include <iostream>
using namespace std;

#include "boost/function.hpp"
#include "boost/ref.hpp"
using namespace boost;

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
#include "boost/lambda/if.hpp"
using namespace boost::lambda;

int main(int argc, char *argv[]) {

  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);
}

-- CODE ENDS --

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).

The error wouldn't appear if I had supplied at least one placeholder
to the operator<< in both if's cases in the lambda expression above.

Is there any way to overcome this limitation?


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