[libcxx-commits] [PATCH] D127159: [libc++] Simplify the char_traits specializations
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 9 09:08:47 PDT 2022
ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.
================
Comment at: libcxx/include/__string/char_traits.h:207
+ char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
----------------
philnik wrote:
> mclow.lists wrote:
> > Does this handle overlapping ranges? The old code does.
> >
> > https://eel.is/c++draft/char.traits.require says it has to handle overlapping ranges.
> While `std::copy_n` doesn't officially support overlapping ranges our implementation forwards trivial types to `__builtin_memmove`, which does handle them properly.
Can you please add tests to cover that (or ensure we already do)?
Also, if we keep this, let's add a comment like `// our implementation of std::copy_n handles overlapping ranges`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127159/new/
https://reviews.llvm.org/D127159
More information about the libcxx-commits
mailing list