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: [Patch/RFA] Further speedup locale::operator==


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 ());
}


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