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.
Section: 28.3.4.3.3.2 [facet.num.put.members] Status: CD1 Submitter: Martin Sebor Opened: 2002-03-12 Last modified: 2016-01-28
Priority: Not Prioritized
View all issues with CD1 status.
Discussion:
22.2.2.2.1, p1:
iter_type put (iter_type out, ios_base& str, char_type fill, bool val) const; ... 1 Returns: do_put (out, str, fill, val).
AFAICS, the behavior of do_put (..., bool) is not documented anywhere, however, 22.2.2.2.2, p23:
iter_type put (iter_type out, ios_base& str, char_type fill, bool val) const;Effects: If (str.flags() & ios_base::boolalpha) == 0 then do out = do_put(out, str, fill, (int)val) Otherwise do
string_type s = val ? use_facet<ctype<charT> >(loc).truename() : use_facet<ctype<charT> >(loc).falsename();and then insert the characters of s into out. out.
This means that the bool overload of do_put()
will never be called,
which contradicts the first paragraph. Perhaps the declaration
should read do_put()
, and not put()
?
Note also that there is no Returns clause for this function, which should probably be corrected, just as should the second occurrence of "out." in the text.
I think the least invasive change to fix it would be something like the following:
Proposed resolution:
In 28.3.4.3.3.3 [facet.num.put.virtuals], just above paragraph 1, remove
the bool
overload.
In 28.3.4.3.3.3 [facet.num.put.virtuals], p23, make the following changes
Replace
put()
withdo_put()
in the declaration of the member function.
Change the Effects clause to a Returns clause (to avoid the requirement to call
do_put(..., int)
fromdo_put (..., bool))
like so:
23 Returns: If
(str.flags() & ios_base::boolalpha) == 0
thendo_put (out, str, fill, (long)val)
Otherwise the function obtains a strings
as if bystring_type s = val ? use_facet<ctype<charT> >(loc).truename() : use_facet<ctype<charT> >(loc).falsename();and then inserts each character
c
of s into out via*out++ = c
and returnsout
.
Rationale:
This fixes a couple of obvious typos, and also fixes what appears to be a requirement of gratuitous inefficiency.