This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
gcc 3.2 compilation problem]
- From: Paul Marculescu <mpaul at gecadsoftware dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Mon, 18 Nov 2002 19:29:41 +0200
- Subject: gcc 3.2 compilation problem]
Hello.
I just upgraded to gcc3.2 and I'm trying to compile this code:
------------------- cut here ---------------------
#include <string>
#include <algorithm>
#include <cctype>
#include <iostream
using namespace std;
std::string& lower( std::string& p_str )
{
std::transform( p_str.begin(), p_str.end(), p_str.begin(), tolower );
return p_str;
}
int main()
{
string s( "AbRacaDABRA" );
lower( s );
cout << s << endl;
return 0;
}
------------------- cut here ---------------------
I get this error:
c.cpp:16: no matching function for call to `transform(
__gnu_cxx::__normal_iterator, std::allocator > >,
__gnu_cxx::__normal_iterator, std::allocator > >,
__gnu_cxx::__normal_iterator, std::allocator > >, )'
If I define a wrapper function for "tolower" in this way:
inline int my_tolower( int x )
{
return tolower(x);
}
and use it in std::transform:
std::transform( p_str.begin(), p_str.end(), p_str.begin(), my_tolower );
everything works just fine.
Can you please give me an explanation for this?
Thank you.