BLL: ::toupper( _1) generates C2664

I have just started with BLL. The following sample shows where I am stuck:
#include <string>
#include <cctype>
#include

AMDG Suman Kar wrote:
I have just started with BLL. The following sample shows where I am stuck:
#include <string> #include <cctype> #include
#include 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));
Exactly. The correct solution is bind. In Christ, Steven Watanabe
participants (2)
-
Steven Watanabe
-
Suman Kar