Title
num_put<>::do_put (..., bool) undocumented
Status
cd1
Section
[facet.num.put.members]
Submitter
Martin Sebor

Created on 2002-03-12.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

This fixes a couple of obvious typos, and also fixes what appears to be a requirement of gratuitous inefficiency.

Date: 2010-10-21.18:28:33

Proposed resolution:

In [facet.num.put.virtuals], just above paragraph 1, remove the bool overload.

In [facet.num.put.virtuals], p23, make the following changes

Replace put() with do_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) from do_put (..., bool)) like so:

23 Returns: If (str.flags() & ios_base::boolalpha) == 0 then do_put (out, str, fill, (long)val) Otherwise the function obtains a string s as if by

             string_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 returns out.

Date: 2002-03-12.00:00:00

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:

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2350
2010-10-21 18:28:33adminsetmessages: + msg2349
2002-03-12 00:00:00admincreate