Boost logo

Boost Users :

Subject: [Boost-users] BLL: ::toupper( _1) generates C2664
From: Suman Kar (skarpio_at_[hidden])
Date: 2009-04-11 03:41:35


I have just started with BLL. The following sample shows where I am stuck:

#include <string>
#include <cctype>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>

int main() {
    using namespace std;
    using namespace boost::lambda;

    string s("hello, world");
    for_each(s.begin(), s.end(), _1 = ::toupper(_1));

    return 0;
}

I hit a C2664: cannot convert parameter 1 from
'boost::lambda::placeholder1_type' to 'int'.
I am using VS2005. Unfortunately, I do not have access to gcc at the
moment to validate
this (dig further).

Of course, I can get the sample to work if I change the for_each
invocation to use a bind:

        for_each(s.begin(), s.end(), _1 = bind(::toupper, _1));

Regards,
Suman


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