[Bug 26] New: inout foreach does not modify BitArrays
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 8 12:01:40 PST 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=26
Summary: inout foreach does not modify BitArrays
Product: D
Version: 0.149
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: wrong-code
Severity: minor
Priority: P2
Component: Phobos
AssignedTo: walter at digitalmars.com
ReportedBy: deewiant at gmail.com
Using inout in a foreach loop through a BitArray has no effect: the bits in the
BitArray do not change when assigned to or otherwise modified.
Can be easily circumvented by using a for loop, but is still an annoyance.
--
import std.bitarray;
void main() {
BitArray a;
a.length = 5;
foreach (inout bit b; a) {
assert (b == 0);
b = 1;
}
foreach (bit b; a)
assert (b == 1); // FAILS, they're all 0
}
--
More information about the Digitalmars-d-bugs
mailing list