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.
std::hive::sort should add Cpp17MoveConstructible to its preconditions on TSection: 23.3.9.5 [hive.operations] Status: New Submitter: Joaquín M López Muñoz Opened: 2026-05-24 Last modified: 2026-05-24
Priority: Not Prioritized
View other active issues in [hive.operations].
View all other issues in [hive.operations].
View all issues with New status.
Discussion:
std::hive::sort (23.3.9.5 [hive.operations])
requires that T be Cpp17MoveInsertable into hive,
Cpp17MoveAssignable, and Cpp17Swappable.
It does not require T to be Cpp17MoveConstructible, which is a
prerequisite for the internal use of std::sort by the implementation.
Note that, in general, Cpp17MoveInsertable into hive (or any
container) does not imply Cpp17MoveConstructible.
Both the de facto reference implementation for std::hive (Matthew
Bentley's plf::hive)
and the ongoing implementation
for VS use std::sort directly on T.
std::sort on a range of values of type X, where X is
an ad-hoc type wrapping a T value and an allocator object which implements
move construction in terms of std::allocator_traits<A>::construct.
So, even if this issue is resolved as NAD, that would be informative for
standard library implementors so that they can potentially fix their code.
Proposed resolution:
This wording is relative to N5046.
Modify 23.3.9.5 [hive.operations] as indicated:
template<class Compare = less<T>> void sort(Compare comp = Compare());-13- Preconditions:
-14- Effects: SortsTis Cpp17MoveInsertable intohive, Cpp17MoveConstructible, Cpp17MoveAssignable, and Cpp17Swappable.*thisaccording to thecompfunction object. If an exception is thrown, the order of the elements in*thisis unspecified. […]