Bug#144409: g++-3.0: does not support transform(begin,end,be
>> int main(int argc, char* argv[]) {
>> string foo = "Some Mixed Case Text";
>> cout << foo << endl;
>> transform(foo.begin(), foo.end(), foo.begin(), tolower);
>
> The compiler can't properly resolve "tolower": The problem is that
> tolower is not only a function in namespace std, it is also a template
> (22.1.3/2). Therefore, in the call to transform, template argument
> deduction fails because of the ambiguity.
>
> You can fix your code in the following ways:
> 1. Define a wrapper function around tolower that you pass to
> transform.
> 2. Explicitly select the tolower you want to use, by writing
>
> transform(foo.begin(), foo.end(), foo.begin(),
> (int(*)(int))std::tolower);
>
> The cast causes, on the one hand, an explicit overload resolution
> in favour of the function; it also allows the compiler to properly
> deduce the third argument to transform.
>
man, neither option is particularly pretty, but the cast does let the code
compile.
I suppose I can define my own tolower() function based on the library's
version rather than use a wrapper.
Thanks for helping Martin. It is disappointing that the above code breaks.
--
To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: