Closed
Description
The recently introduced slice method swap_with_slice() can't be used to swap two nonoverlapping parts of a single slice. But when you reshuffle parts of a single slice I think it could be useful. So I suggest to offer a slice function that performs this operation safely:
v.swap_nonoverlapping(i, j, n);
That's just a wrapper around (plus panics):
use std::ptr::swap_nonoverlapping;
swap_nonoverlapping(v[i ..].as_mut_ptr(), v[j ..].as_mut_ptr(), n);