From: Oscar F. <of...@wa...> - 2002-09-17 23:06:15
|
Greg Chicares <chi...@mi...> writes: > Josuttis's example is given below, with comeau and g++3.1 > results: comeau accepts the code without diagnostics, and > g++ rejects it. Thanks for the example. This is the real problem: #include <algorithm> #include <string> template <typename T> T foo(T v, T w) { return v+w; } char foo(char v) { return v; } int main() { std::string s("hello"); std::transform( s.begin(), s.end(), s.begin(), foo); } (g++ 3.2) d:/des/cppExp # t:/mingw/bin/g++ tolo3.cpp tolo3.cpp: In function `int main()': tolo3.cpp:14: no matching function for call to `transform( __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unknown type>)' D:\Des\cppExp>como --A -strict --long_long tolo3.cpp Comeau C/C++ 4.3.0.1 (Aug 21 2002 15:45:32) for MS_WINDOWS_x86 Copyright 1988-2002 Comeau Computing. All rights reserved. MODE:strict errors C++ [snipped prelinker messages] Comeau C/C++ 4.3.0.1 (Aug 21 2002 15:45:32) for MS_WINDOWS_x86 Copyright 1988-2002 Comeau Computing. All rights reserved. MODE:strict errors C++ *Now*, it seems there is a bug either on g++ or on como Bets anyone? ;-) [snip] > In fact, libcomo uses the same technique: include > the C <ctype.h> header, then import the names into > namespace std with using-declarations. Comeau and GCC are C/C++ compilers. They save work by re-cycling the C standard libraries, sacrificing C++ compliance. [snipped Josutti's example and compiler output] Thanks again. -- Oscar |