D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4228 - std.array.replace contains 2 bugs
Summary: std.array.replace contains 2 bugs
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-23 10:59 UTC by SHOO
Modified: 2014-02-15 02:43 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description SHOO 2010-05-23 10:59:40 UTC
1. std.array.replace cannot receive null

It should run following code:
----------
int[] a = [1, 4, 5];
replace(a, 1u, 2u, null);
assert(a == [1, 5]);
----------


2. std.array.replace have strange behavior when array.length shrinks.

It should run following code:
----------
int[] a = [1, 4, 5];
replace(a, 1u, 4u, [2]);
assert(a == [1, 2]);
----------
Comment 1 SHOO 2010-05-23 11:11:30 UTC
Fixed in svn r1547.