Boost logo

Ublas :

From: Haroon Khan (haroon.khan_at_[hidden])
Date: 2006-11-27 02:12:44

I'm experimenting with the boost lambda library, and I wrote the
following code, to go through the vector of numbers and print out
statements if the number is greater than 5 or less than 5

    int a[]={1,2,3,4,5,6,7,8,9,10,10,9,8,4,7,6,5,4,3,3,1};
    std::vector<int> v(a,a+sizeof(a)/sizeof(int));
            ( v.begin()
            , v.end()
            , (if_(_1<5)[
                    std::cout<<var((boost::format("%d is less than
                    std::cout<<var((boost::format("%d is greater than
                ]) );

Unfortunately, the boost::basic_format::operator % code gives an
assertion since
the object that is being passed is the placeholder object, and not
the current value. Is there a correct way of doing this?

Thanks, Haroon