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

360. locale mandates inefficient implementation

Section: 30.3.1 [locale] Status: CD1 Submitter: Martin Sebor Opened: 2002-03-12 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [locale].

View all issues with CD1 status.

Discussion:

22.1.1, p7 (copied below) allows iostream formatters and extractors to make assumptions about the values returned from facet members. However, such assumptions are apparently not guaranteed to hold in other cases (e.g., when the facet members are being called directly rather than as a result of iostream calls, or between successive calls to the same iostream functions with no interevening calls to imbue(), or even when the facet member functions are called from other member functions of other facets). This restriction prevents locale from being implemented efficiently.

Proposed resolution:

Change the first sentence in 22.1.1, p7 from

In successive calls to a locale facet member function during a call to an iostream inserter or extractor or a streambuf member function, the returned result shall be identical. [Note: This implies that such results may safely be reused without calling the locale facet member function again, and that member functions of iostream classes cannot safely call imbue() themselves, except as specified elsewhere. --end note]

to

In successive calls to a locale facet member function on a facet object installed in the same locale, the returned result shall be identical. ...

Rationale:

This change is reasonable becuase it clarifies the intent of this part of the standard.