This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
vector<bool, Allocator>
mandate that Allocator::value_type
is bool
?Section: 23.3.14.1 [vector.bool.pspc] Status: New Submitter: Stephan T. Lavavej Opened: 2025-03-18 Last modified: 2025-03-22
Priority: Not Prioritized
View all other issues in [vector.bool.pspc].
View all issues with New status.
Discussion:
N5008 23.3.14.1 [vector.bool.pspc]/2 says:
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 andallocator_traits::construct
(20.2.9.3 [allocator.traits.members]) is not used to construct these values.
23.2.2.5 [container.alloc.reqmts]/5 says:
Mandates:
allocator_type::value_type
is the same asX::value_type
.
Is vector<bool, allocator<int>>
forbidden? There's implementation divergence:
MSVC's STL enforces the mandate, while libc++ and libstdc++ accept this code, discovered while
running libc++'s tests with MSVC's STL.
vector<bool>
should be unique among containers in accepting allocator<Anything>
, then I believe that
a normative sentence should be added to 23.3.14.1 [vector.bool.pspc]/2, specifically creating an exemption
to 23.2.2.5 [container.alloc.reqmts]/5.
Proposed resolution: