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: char_traits patch, round two


* 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


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