This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch/RFA] Further speedup locale::operator==
- From: Martin Sebor <sebor at roguewave dot com>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 29 Apr 2004 10:08:20 -0600
- Subject: Re: [Patch/RFA] Further speedup locale::operator==
- References: <409039A0.3000501@suse.de>
Paolo Carlini wrote:
Hi,
if I understand well the standard (i.e, 22.1.1.2) it is impossible for
a locale which has no name to acquire one.
The standard does say it, but that doesn't make it useful. In
a recent discussion on the WG21 reflector about issue 452 (see
the thread starting with c++std-lib-13439), those involved all
agreed that the standard goes a little too far in its requirements
on locale names and that implementations should be permitted to
construct named locales in some cases where the standard currently
requires an unnamed one.
Martin
PS Consider the program below (which runs successfully with
our latest implementation):
#include <cassert>
#include <locale>
int main (int argc, char *argv[])
{
const std::locale one (argc > 1 ? argv [1] : "");
const std::locale two (argc > 2 ? argv [2] : "");
typedef std::ctype<char> C;
typedef std::ctype<wchar_t> W;
const std::locale comb =
one.combine<W>(one.combine<C>(two));
assert ("*" != comb.name ());
const std::locale orig =
comb.combine<W>(comb.combine<C>(one));
assert (one == orig);
assert (one.name () == orig.name ());
}