Title
bitset::to_string() hard to use
Status
cd1
Section
[bitset.members]
Submitter
Martin Sebor

Created on 2003-10-15.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

[ Kona: the LWG agrees that this is an improvement over the status quo. Dietmar thought about an alternative using a proxy object but now believes that the proposed resolution above is the right choice. ]

Date: 2010-10-21.18:28:33

Proposed resolution:

In order to allow callers to specify no template arguments at all, just the first one (charT), or the first 2 (charT and traits), in addition to all three template arguments, add the following three overloads to both the interface (declarations only) of the class template bitset as well as to section 23.3.5.2, immediately after p34, the Returns clause of the existing to_string() member function template:

    template <class charT, class traits>
    basic_string<charT, traits, allocator<charT> >
    to_string () const;

    -34.1- Returns: to_string<charT, traits, allocator<charT> >().

    template <class charT>
    basic_string<charT, char_traits<charT>, allocator<charT> >
    to_string () const;

    -34.2- Returns: to_string<charT, char_traits<charT>, allocator<charT> >().

    basic_string<char, char_traits<char>, allocator<char> >
    to_string () const;

    -34.3- Returns: to_string<char, char_traits<char>, allocator<char> >().
Date: 2003-10-15.00:00:00

It has been pointed out a number of times that the bitset to_string() member function template is tedious to use since callers must explicitly specify the entire template argument list (3 arguments). At least two implementations provide a number of overloads of this template to make it easier to use.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2629
2010-10-21 18:28:33adminsetmessages: + msg2628
2003-10-15 00:00:00admincreate