This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

1254. Misleading sentence in vector<bool>::flip

Section: 23.3.12 [vector.bool] Status: C++11 Submitter: Christopher Jefferson Opened: 2009-11-01 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [vector.bool].

View all other issues in [vector.bool].

View all issues with C++11 status.

Discussion:

The effects of vector<bool>::flip has the line:

It is unspecified whether the function has any effect on allocated but unused bits.

While this is technically true, it is misleading, as any member function in any standard container may change unused but allocated memory. Users can never observe such changes as it would also be undefined behaviour to read such memory.

[ 2009-11-14 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

Proposed resolution:

Strike second sentence from the definition of vector<bool>::flip(), 23.3.12 [vector.bool], paragraph 5.

Effects: Replaces each element in the container with its complement. It is unspecified whether the function has any effect on allocated but unused bits.