Re: find_if and ptr_fun(isspace<char>) trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gabriel Dos Reis wrote:
Dan Kegel <dank@xxxxxxxxx> 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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux