Re: tolower
Re: tolower
- Subject: Re: tolower
- From: Scott Thompson <email@hidden>
- Date: Thu, 16 Jun 2005 09:40:03 -0500
On Jun 15, 2005, at 7:35 PM, Tim Conkling wrote:
Another CW->Xcode transition problem:
I have a function:
void MAKELOWERCASE(string s)
{
transform(s.begin(), s.end(), s.begin(), tolower);
}
which produces the following error:
error: no matching function for call to 'transform
(__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, <unknown type>)'
Changing the body of the function to:
transform(s.begin(), s.end(), s.begin(), ::tolower);
fixes things. Why is this?
It appears that "tolower" is defined in more than one namespace.
That shows up to the compiler as an ambiguously defined function and
the transform template doesn't know which one it should use (the
computer can't create a version of transform whose parameter matches
because the last parameter is ambiguous). When you put the scope
resolution operator on it, it is able to resolve that to an actual
function and continue on.
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >tolower (From: Tim Conkling <email@hidden>) |