From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24428 invoked by alias); 18 Dec 2004 09:44:59 -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 24383 invoked from network); 18 Dec 2004 09:44:52 -0000 Received: from unknown (HELO relay.pair.com) (209.68.1.20) by sourceware.org with SMTP; 18 Dec 2004 09:44:52 -0000 Received: (qmail 93778 invoked from network); 18 Dec 2004 09:44:51 -0000 Received: from unknown (HELO ?192.168.123.1?) (unknown) by unknown with SMTP; 18 Dec 2004 09:44:51 -0000 X-pair-Authenticated: 24.126.73.164 Message-ID: <41C3ED85.5080900@kegel.com> Date: Sat, 18 Dec 2004 09:44:00 -0000 From: Dan Kegel User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: find_if and ptr_fun(isspace) trouble Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-12/txt/msg00175.txt.bz2 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)); } with either gcc-3.2.2 (redhat 9) or gcc-3.4.1 yields the following error: /usr/include/c++/3.2.2/bits/stl_algo.h: In function `_RandomAccessIter std::find_if(_RandomAccessIter, _RandomAccessIter, _Predicate, std::random_access_iterator_tag) [with _RandomAccessIter = std::_Deque_iterator, _Predicate = std::pointer_to_binary_function]': /usr/include/c++/3.2.2/bits/stl_algo.h:318: instantiated from `_InputIter std::find_if(_InputIter, _InputIter, _Predicate) [with _InputIter = std::_Deque_iterator, _Predicate = std::pointer_to_binary_function]' a.cc:13: instantiated from here /usr/include/c++/3.2.2/bits/stl_algo.h:252: no match for call to `( std::pointer_to_binary_function) (char&)' /usr/include/c++/3.2.2/bits/stl_function.h:465: candidates are: _Result std::pointer_to_binary_function<_Arg1, _Arg2, _Result>::operator()(_Arg1, _Arg2) const [with _Arg1 = char, _Arg2 = const std::locale&, _Result = bool] (This is an improvement; the original code didn't specify which isspace, and blew up in a worse way.) Can anybody point out what's wrong? Thanks, Dan -- Trying to get a job as a c++ developer? See http://kegel.com/academy/getting-hired.html