[libcxx-commits] [PATCH] D127159: [libc++] Simplify the char_traits specializations

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 6 16:02:51 PDT 2022


philnik marked an inline comment as done.
philnik added inline comments.


================
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;
----------------
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.


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