842. ConstructibleAsElement and bit containers

Section: 26.2 [container.requirements], 26.3.12 [vector.bool], 23.9.2 [template.bitset] Status: CD1 Submitter: Howard Hinnant Opened: 2008-06-03 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [container.requirements].

View all issues with CD1 status.

Discussion:

26.2 [container.requirements] p. 3 says:

Objects stored in these components shall be constructed using construct_element (20.6.9). For each operation that inserts an element of type T into a container (insert, push_back, push_front, emplace, etc.) with arguments args... T shall be ConstructibleAsElement, as described in table 88. [Note: If the component is instantiated with a scoped allocator of type A (i.e., an allocator for which is_scoped_allocator<A>::value is true), then construct_element may pass an inner allocator argument to T's constructor. -- end note]

However vector<bool, A> (26.3.12 [vector.bool]) and bitset<N> (23.9.2 [template.bitset]) store bits, not bools, and bitset<N> does not even have an allocator. But these containers are governed by this clause. Clearly this is not implementable.

Proposed resolution:

Change 26.2 [container.requirements] p. 3:

Objects stored in these components shall be constructed using construct_element (20.6.9), unless otherwise specified. For each operation that inserts an element of type T into a container (insert, push_back, push_front, emplace, etc.) with arguments args... T shall be ConstructibleAsElement, as described in table 88. [Note: If the component is instantiated with a scoped allocator of type A (i.e., an allocator for which is_scoped_allocator<A>::value is true), then construct_element may pass an inner allocator argument to T's constructor. -- end note]

Change 26.3.12 [vector.bool]/p2:

Unless described below, all operations have the same requirements and semantics as the primary vector template, except that operations dealing with the bool value type map to bit values in the container storage, and construct_element (26.2 [container.requirements]) is not used to construct these values.

Move 23.9.2 [template.bitset] to clause 20.