This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: char_traits patch, round two
- From: Philipp Thomas <pthomas at suse dot de>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: Andreas Jaeger <aj at suse dot de>, Benjamin Kosnik <bkoz at redhat dot com>,libstdc++ at gcc dot gnu dot org, Ruediger Oertel <ro at suse dot de>
- Date: Mon, 12 Aug 2002 18:14:33 +0200
- Subject: Re: char_traits patch, round two
- References: <200207290741.g6T7f7X26915@fillmore.constant.com> <hod6somizg.fsf@gee.suse.de> <m3bs88xpmj.fsf@soliton.integrable-solutions.net>
* Gabriel Dos Reis (gdr@integrable-solutions.net) [20020812 13:53]:
> I'm curious: How did you manage to reference std::char_traits<unsigned
> char>::move()? I'm asking that because, depending on the context you
> would have to specialize other things as well...
Because in this case the software has this in one of its headers:
typedef std::basic_string<unsigned char> BString;
just try this:
-------------------cut-----------------------
#include <string>
typedef std::basic_string<unsigned char> BString;
std::string::size_type bar(unsigned char *data, std::size_t len)
{
BString str(data, len);
BString str3 = str + str;
return str.size() + str3.size();
}
-----------------cut-------------------------
Compile with 'c++ -O2 -c t.cpp' and then do 'nm --demangle --undefined-only t.o'
and amongst others you'll find:
std::char_traits<unsigned char>::copy(unsigned char*, unsigned char const*, unsigned)
std::char_traits<unsigned char>::move(unsigned char*, unsigned char const*, unsigned)
So it seems like any code using unsigned char based strings needs a
specialization of char_traits<unsigned char>, right?
Philipp
--
Philipp Thomas <pthomas@suse.de>
SuSE Linux AG, Deutscherrnstr. 15-19, D-90429 Nuremberg, Germany