You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a small helper type in a sorting library of mine to check that a sorting algorithm supports the same requirements as std::sort:
It works with move-only types
It works with types that are not default-constructible
It even checks that it does not perform any read from a moved-from object
While your drop-merge sort does work with move-only types, it seems that it doesn't like types that are not default-constructible. When I tried to use the aforementioned type, it chocked on std::vector::resize. Apparently, dropping the resize and using a loop of equivalent pop_back in its stead is enough to make the algorithm work with types that are not default-constructible.
The text was updated successfully, but these errors were encountered:
I've got a small helper type in a sorting library of mine to check that a sorting algorithm supports the same requirements as
std::sort
:While your drop-merge sort does work with move-only types, it seems that it doesn't like types that are not default-constructible. When I tried to use the aforementioned type, it chocked on
std::vector::resize
. Apparently, dropping theresize
and using a loop of equivalentpop_back
in its stead is enough to make the algorithm work with types that are not default-constructible.The text was updated successfully, but these errors were encountered: