Title
Do use_facet and has_facet look in the global locale?
Status
tc1
Section
[locale]
Submitter
Angelika Langer

Created on 1999-03-17.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

Needed for consistency with the way locales are handled elsewhere in the standard.

Date: 2010-10-21.18:28:33

Proposed resolution:

Remove the phrase "(or, failing that, in the global locale)" from section 22.1.1.

Date: 1999-03-17.00:00:00

Section [locale] says:

-4- In the call to use_facet<Facet>(loc), the type argument chooses a facet, making available all members of the named type. If Facet is not present in a locale (or, failing that, in the global locale), it throws the standard exception bad_cast. A C++ program can check if a locale implements a particular facet with the template function has_facet<Facet>().

This contradicts the specification given in section [locale.global.templates]:

template <class  Facet> const  Facet& use_facet(const locale&  loc);

-1- Get a reference to a facet of a locale.
-2- Returns: a reference to the corresponding facet of loc, if present.
-3- Throws: bad_cast if has_facet<Facet>(loc) is false.
-4- Notes: The reference returned remains valid at least as long as any copy of loc exists

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1654
2010-10-21 18:28:33adminsetmessages: + msg1653
1999-03-17 00:00:00admincreate