memcpy() comparison: C, Rust, and D
Tobias Müller via Digitalmars-d
digitalmars-d at puremagic.com
Wed Feb 1 09:29:07 PST 2017
Tobias Müller <troplin at bluewin.ch> wrote:
> Walter Bright
> But if you still wanted a memcpy it would probably look like this:
>
> fn memcpy<'a, T>(dest: &'a mut [T], src: &[T]) -> &'a mut [T]
No, sorry:
fn memcpy<'a, T: Copy>(dest: &'a mut [T], src: &[T]) -> &'a mut [T]
And mutable references can never alias, you have the same guarantees as
with _restrict, statically checked even at the call site.
More information about the Digitalmars-d
mailing list