[libcxx-commits] [PATCH] D92190: [libc++] fix std::sort(T**, T**)
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 26 10:02:17 PST 2020
ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.
LGTM, but please take @arichardson 's suggestions. Requesting changes until those suggestions are applied.
================
Comment at: libcxx/include/algorithm:4165
{
- _VSTD::sort((size_t*)__first, (size_t*)__last, __less<size_t>());
+ _VSTD::sort((uintptr_t*)__first, (uintptr_t*)__last, __less<uintptr_t>());
}
----------------
It looks like the correct thing to do regardless of the architecture. Semantically, what we want to do is sort the elements in `[first, last)` as if they were integers, but `size_t` is not guaranteed to be able to hold a pointer. `uintptr_t` (or `intptr_t`) are the types for that.
So I agree with this change.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92190/new/
https://reviews.llvm.org/D92190
More information about the libcxx-commits
mailing list