Title
Impossible "as if" clauses
Status
cd1
Section
[filebuf] [facet.num.put.virtuals]
Submitter
Daniel Krügler

Created on 2007-02-20.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

In [filebuf]/5 change the "as if" code

const codecvt<charT,char,typename traits::state_type>& a_codecvt =
  use_facet<codecvt<charT,char,typename traits::state_type> >(getloc());

In [facet.num.put.virtuals]/15 (This is para 5 in N2134) change

A local variable punct is initialized via

const numpunct<charT>& punct = use_facet< numpunct<charT> >(str.getloc() );

(Please note also the additional provided trailing semicolon)

Date: 2007-02-20.00:00:00

The current standard 14882:2003(E) as well as N2134 have the following defects:

[filebuf]/5 says:

In order to support file I/O and multibyte/wide character conversion, conversions are performed using members of a facet, referred to as a_codecvt in following sections, obtained "as if" by

codecvt<charT,char,typename traits::state_type> a_codecvt =
  use_facet<codecvt<charT,char,typename traits::state_type> >(getloc());

use_facet returns a const facet reference and no facet is copyconstructible, so the codecvt construction should fail to compile.

A similar issue arises in [facet.num.put.virtuals]/15 for num_punct.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3316
2007-02-20 00:00:00admincreate