[libcxx-commits] [PATCH] D68840: [libc++][P0980] Marked member functions move/copy/assign of char_traits constexpr.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 11 09:47:17 PDT 2019
ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.
================
Comment at: libcxx/include/__string:227
+ if (__n == 0) return __s1;
+ if (!__libcpp_is_constant_evaluated()) {
+ return (char_type*)memmove(__s1, __s2, __n);
----------------
I think it'd be better to have `if (__libcpp_is_constant_evaluated()) { ... } else { ... }` than just the early return. I normally don't care about this stuff, however in the case of `is_constant_evaluated`, I feel like having a clear `if-else` makes it clearer that we're doing the same thing in both branches, one in the compile-time world and one in the runtime world.
Also, it might be a good idea to define a `__memmove_constexpr` function that we can call as-is from the `else` branch?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68840/new/
https://reviews.llvm.org/D68840
More information about the libcxx-commits
mailing list