logoalt Hacker News

quuxplusonetoday at 2:15 AM2 repliesview on HN

...Ah, `heap_sort` is used only for trivially copyable types. So my complaint about not distinguishing copy from move is essentially unimportant (matters only in pathological cases that we shouldn't worry about).

But it's perfectly possible for a type to be "trivially copyable" without being "default-constructible." An example of such a type from the STL: `std::reference_wrapper<int>`.

Anyway, looks like a quick fix for this would be to just extend the list of traits on which blqsort is gated (currently `is_trivially_copyable` and `sizeof(T) <= 16`) by adding `is_trivially_default_constructible<T>::value` also.


Replies

chrkatoday at 7:18 AM

Author here. No, it's also called from the non_trivially_copyable branch (as a fallback). I'll fix that.

NooneAtAll3today at 5:11 AM

why such love for copies tho?

why look for trivial copy and not trivial move?