-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use memmove optimisations when appropriate #107
Comments
Could we potentially also use |
You can also use |
Thanks for the info Jonathan! |
FWIW, we do use (Yes, I have an action item to teach this about |
When using the |
Doing so is undefined behaviour. |
When using contiguous iterators with trivially copyable/movable value types, we should be able to optimise
copy
/move
and their backwards versions to usestd::memmove
. This would have knock-on benefits for several other algorithms which end up copying or moving elements in their implementations.Unfortunately
memmove
is notconstexpr
, so we'd need to use C++20std::is_constant_evaluated
to detect whether we're being called at compile-time (and should therefore just use the normal implementation) or at run-time. The preprocessor define__cpp_lib_is_constant_evaluated
is supported in GCC and Clang to find out whetheris_constant_evaluated
is available, but I'm not sure about MSVC.The text was updated successfully, but these errors were encountered: