From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25628 invoked by alias); 19 Dec 2004 15:48:10 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 25559 invoked from network); 19 Dec 2004 15:48:03 -0000 Received: from unknown (HELO uniton.integrable-solutions.net) (62.212.99.186) by sourceware.org with SMTP; 19 Dec 2004 15:48:03 -0000 Received: from uniton.integrable-solutions.net (localhost [127.0.0.1]) by uniton.integrable-solutions.net (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id iBJFk5Q0008372; Sun, 19 Dec 2004 16:46:05 +0100 Received: (from gdr@localhost) by uniton.integrable-solutions.net (8.12.10/8.12.10/Submit) id iBJFk5XW008371; Sun, 19 Dec 2004 16:46:05 +0100 X-Authentication-Warning: uniton.integrable-solutions.net: gdr set sender to gdr@integrable-solutions.net using -f To: Dan Kegel Cc: gcc-help@gcc.gnu.org Subject: Re: find_if and ptr_fun(isspace) trouble References: <41C3ED85.5080900@kegel.com> From: Gabriel Dos Reis In-Reply-To: <41C3ED85.5080900@kegel.com> Organization: Integrable Solutions Date: Sun, 19 Dec 2004 15:48:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-12/txt/msg00188.txt.bz2 Dan Kegel 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). | | Compiling the following snippet: | | #include | #include | #include | #include | #include | using namespace std; | int main () | { | char init[7] = {1,2,3,4,5,6,7}; | deque d(init, init+7); | find_if (d.begin(), d.end(), ptr_fun(isspace)); The code is wrong because it pulls in two version of isspace * one in -- the traditional C function; * another in -- 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. Try to add struct Isspace { bool operator()(int c) const { return isspace(c); } }; and try find_if (d.begin(), d.end(), Isspace()); Also hae a look at: http://gcc.gnu.org/onlinedocs/libstdc++/21_strings/howto.html#4 -- Gaby