Re: malloc() fail
On Sep 28, 5:37 am, Jeff Schwab <j...@schwabcenter.com> wrote:
Gianni Mariani wrote:
[...]
BTW - what's wrong with :
typedef std::basic_string<short> String;
1) It's not as much fun. Fun was the OP's stated goal.
2) The standard doesn't define char_traits specializations for anything
other than char and wchar_t. char_traits<short> could mean different
things with different standard library implementations, and so could
basic_string<short>.
For that matter, the standard doesn't require a generic
implementation char_traits at all, in which case,
basic_string<short> won't even compile. (Most compilers do
provide one, but I've heard actual complaints that the semantics
it defines are not the same, at least for unsigned integral
types, with g++ and VC++.)
When all is said and done, all making std::basic_string a
template bought us was to make it easier for the standards
committee to add new string types down the road, e.g.
std::basic_string< char16_t > (which will be present in the next
version of the standard).
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34