This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc 3.2 compilation problem]


Paul Marculescu <mpaul@gecadsoftware.com> writes:

| Hello.
| 
| I just upgraded to gcc3.2 and I'm trying to compile this code:
| 
| ------------------- cut here ---------------------
| 
| #include <string>
| #include <algorithm>
| #include <cctype>
| #include <iostream
| 
| using namespace std;
| 
| std::string& lower( std::string& p_str )
| {
|     std::transform( p_str.begin(), p_str.end(), p_str.begin(), tolower );
                                                                 ^^^^^^^

This ought to be a FAQ.

Three facts:

  1) std::tolower (resp. std::toupper) is an overloaded function.
  2) C++ has no type for the set of overloaded functions.
  3) Template-argument deduction works by unifying the argument type with
     function parameter types. 

by point 2), point 3) cannot succeed, hence the error.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]