[Issue 10930] std.array.replace cannot simple replace an element in array
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Aug 31 03:52:15 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=10930
ZombineDev <petar.p.kirov at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |petar.p.kirov at gmail.com
--- Comment #5 from ZombineDev <petar.p.kirov at gmail.com> ---
The main issue with `replaceInPlace(arr, 1, 2, [2])` is that:
1. The simple usage requires a dynamic allocation for the `[2]` array. The user
could use a separate static array and pass a slice to it, or use `only(2)`, but
it's not convenient for such simple use case
2. A `replaceInPlace` overload takes a single element, instead of a range can
be made much faster by using specialized SIMD instructions, which is worth
considering
--
More information about the Digitalmars-d-bugs
mailing list