char_traits patch, round two
Philipp Thomas
pthomas@suse.de
Mon Aug 12 09:14:00 GMT 2002
* 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
More information about the Libstdc++
mailing list