rtrimws: can't compile in g++
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Jul 7 08:13:00 GMT 2011
On 7 July 2011 06:30, eric <cneric12lin0@gmail.com> wrote:
> Dear advanced c++ programers:
>
> I copied and tested a piece simple Trimming string code from book c+
> + cookbook in chapter4, section2
> Example 4-4:Trim trailing whitespace. You can download and try it by
> yourself.
> -------------------------------------------------
> http://examples.oreilly.com/9780596007614/
> -------------------------------------------------------------------
> in my g++ 4.5.2, compiler reponse
> --------------------
> 4-4.cpp: In function ‘void rtrimws(std::string&)’:
> 4-4.cpp:21:21: error: too many arguments to function ‘void
> rtrimws(std::string&)’
> 4-4.cpp:20:6: note: declared here
> ------------
> according to the book, all book example code is compiled success in
> Visual C++ compiler
The code is buggy, the function isspace is overloaded so this line
cannot compile:
rtrimws(s, isspace);
Contact the authors, it's not a g++ problem.
More information about the Gcc-help
mailing list