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

842. ConstructibleAsElement and bit containers

Section: 24.2 [container.requirements], 24.3.12 [vector.bool], 22.9.2 [template.bitset] Status: CD1 Submitter: Howard Hinnant Opened: 2008-06-03 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [container.requirements].

View all issues with CD1 status.

Discussion:

24.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> (24.3.12 [vector.bool]) and bitset<N> (22.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 24.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 24.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 (24.2 [container.requirements]) is not used to construct these values.

Move 22.9.2 [template.bitset] to clause 20.