Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofTC1 status.

137. Do use_facet and has_facet look in the global locale?

Section: 28.3.3.1[locale]Status:TC1Submitter: Angelika LangerOpened: 1999-03-17Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [locale].

View all issues withTC1 status.

Discussion:

Section 28.3.3.1[locale] says:

-4- In the call to use_facet<Facet>(loc), the type argumentchooses a facet, making available all members of the named type. IfFacet is not present in a locale (or, failing that, in the globallocale), it throws the standard exception bad_cast. A C++ program cancheck if a locale implements a particular facet with the templatefunction has_facet<Facet>().

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

template <class  Facet> const  Facet& use_facet(constlocale&  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

Proposed resolution:

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

Rationale:

Needed for consistency with the way locales are handled elsewherein the standard.


[8]ページ先頭

©2009-2026 Movatter.jp