1250. <bitset> still overspecified

Section: 23.9.2 [template.bitset] Status: C++11 Submitter: Martin Sebor Opened: 2009-10-29 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [template.bitset].

View all issues with C++11 status.

Discussion:

Issue 1227<bitset> synopsis overspecified makes the observation that std::bitset, and in fact the whole library, may be implemented without needing to #include <stdexcept> in any library header. The proposed resolution removes the #include <stdexcept> directive from the header.

I'd like to add that the <bitset> header (as well as the rest of the library) has also been implemented without #including the <cstddef> header in any library header. In the case of std::bitset, the template is fully usable (i.e., it may be instantiated and all its member functions may be used) without ever mentioning size_t. In addition, just like no library header except for <bitset> #includes <stdexcept> in its synopsis, no header but <bitset> #includes <cstddef> either.

Thus I suggest that the #include <cstddef> directive be similarly removed from the synopsis of <bitset>.

[ 2010-02-08 Moved to Tentatively Ready after 6 positive votes on c++std-lib. ]

Proposed resolution:

Change 23.9.2 [template.bitset]:

#include <cstddef>        // for size_t
#include <string>
#include <iosfwd>         // for istream, ostream
namespace std {
...