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]


On Mon, Nov 18, 2002 at 02:28:33PM -0600, Benjamin Kosnik wrote:
> >This ought to be a FAQ.
> 
> Yep. Two related bug reports:

We probably shouldn't recommend it in the libstdc++ docs:

http://gcc.gnu.org/onlinedocs/libstdc++/21_strings/howto.html#4

Selected highlights:

   // Change everything into upper case
   std::transform (s.begin(), s.end(), s.begin(), toupper);
   ...
   NOTE ... This is absolutely guaranteed to work ...

:-)

I can change it to use a function object such as:

template <typename C>
   struct ToLower
   {
      C operator()(C c) { return tolower(c); }
   };

std::transform( p_str.begin(), p_str.end(), p_str.begin(), ToLower<char>() );

or keep it simple and use a wrapper function like Paul's that only works
with one character type?

jon


-- 
"In theory, practice and theory are the same,
 but in practice they are different."
	- Larry McVoy


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