[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 13 04:07:54 PDT 2022


philnik added inline comments.


================
Comment at: libcxx/include/__string/char_traits.h:529
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-    static char_type*       move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
+    static char_type*       move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+        std::copy_n(__s2, __n, __s1);
----------------
EricWF wrote:
> Don't we externally instantiate char_traits? This change would allow the compiler to instantiate and generate code in each TU for these functions. Maybe that's what we want, maybe that isn't. But we should consider it.
All the functions are marked `_LIBCPP_INLINE_VISIBILITY`? Even if we had an extern template they wouldn't be part of it.


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