ConstructibleAsElement
and bit containersSection: 23.2 [container.requirements], 23.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:
23.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 typeT
into a container (insert
,push_back
,push_front
,emplace
, etc.) with argumentsargs... T
shall beConstructibleAsElement
, as described in table 88. [Note: If the component is instantiated with a scoped allocator of typeA
(i.e., an allocator for whichis_scoped_allocator<A>::value
istrue
), thenconstruct_element
may pass an inner allocator argument toT
's constructor. -- end note]
However vector<bool, A>
(23.3.12 [vector.bool]) and bitset<N>
(22.9.2 [template.bitset]) store bits, not bool
s, 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 23.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 typeT
into a container (insert
,push_back
,push_front
,emplace
, etc.) with argumentsargs... T
shall beConstructibleAsElement
, as described in table 88. [Note: If the component is instantiated with a scoped allocator of typeA
(i.e., an allocator for whichis_scoped_allocator<A>::value
istrue
), thenconstruct_element
may pass an inner allocator argument toT
's constructor. -- end note]
Change 23.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 thebool
value type map to bit values in the container storage, andconstruct_element
(23.2 [container.requirements]) is not used to construct these values.
Move 22.9.2 [template.bitset] to clause 20.