find_if and ptr_fun(isspace<char>) trouble
Dan Kegel
dank@kegel.com
Mon Dec 20 04:59:00 GMT 2004
Gabriel Dos Reis wrote:
> Dan Kegel <dank@kegel.com> writes:
>
> | I'm trying to port somebody else's code from g++-2.95.3 to g++-3.4.1, but am
> | running into template problems with STL algorithms and ptr_fun(isspace<char>).
> |
> | Compiling the following snippet:
> |
> | #include <cctype>
> | #include <functional>
> | #include <algorithm>
> | #include <deque>
> | #include <locale>
> | using namespace std;
> | int main ()
> | {
> | char init[7] = {1,2,3,4,5,6,7};
> | deque<char> d(init, init+7);
> | find_if (d.begin(), d.end(), ptr_fun(isspace<char>));
>
> The code is wrong because it pulls in two version of isspace
>
> * one in <cctype> -- the traditional C function;
> * another in <locale> -- the C++ only version that takes two
> arguments: the locale and the character.
>
> and then is trying to use the second version in place of the first.
Thanks!
- Dan
--
Trying to get a job as a c++ developer? See http://kegel.com/academy/getting-hired.html
More information about the Gcc-help
mailing list