2/26/2008

transform in stl with gcc4.0.3

I try to complie next code with gcc 4.0.3


#include < iostream >
#include < string >
#include < algorithm >
#include < cctype >
using namespace std;

int main(void)
{
string tmp("ABC");
cout << tmp << endl;
transform(tmp.begin(),
tmp.end(),
tmp.begin(),
tolower);
cout << tmp << endl;
return 0;
}


GCC can not accept above codes, compile error happens.

Becuase "tolower" function is not certain type.

So I builded wrapper function of tolower, Compile is succeed.

No comments: