Re: BitArray Slicing

2016-12-21 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 12:00:57 UTC, Ezneh wrote: On Wednesday, 21 December 2016 at 11:49:06 UTC, Ilya Yaroshenko wrote: [...] Thanks, I'll check that solution to see if it fits my needs. As an off-topic question, is there any plan in Mir to implement the Tiny Mersenne Twister[1]

Re: BitArray Slicing

2016-12-21 Thread Ezneh via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 11:49:06 UTC, Ilya Yaroshenko wrote: On Wednesday, 21 December 2016 at 09:08:51 UTC, Ezneh wrote: Hi, in one of my projects I have to get a slice from a BitArray. I am trying to achieve that like this : void foo(BitArray ba) { auto slice = ba[0..3]; // Ass

Re: BitArray Slicing

2016-12-21 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 09:08:51 UTC, Ezneh wrote: Hi, in one of my projects I have to get a slice from a BitArray. I am trying to achieve that like this : void foo(BitArray ba) { auto slice = ba[0..3]; // Assuming it has more than 4 elements } The problem is that I get an error

Re: BitArray Slicing

2016-12-21 Thread Ezneh via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 09:14:04 UTC, Eugene Wissner wrote: The problem is BitArray keeps multiple elements in one byte. You can't return just three bits but in the best case one byte with 8 elements. What could be done some internal range could be returned that gives access to

Re: BitArray Slicing

2016-12-21 Thread Eugene Wissner via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 09:08:51 UTC, Ezneh wrote: Hi, in one of my projects I have to get a slice from a BitArray. I am trying to achieve that like this : void foo(BitArray ba) { auto slice = ba[0..3]; // Assuming it has more than 4 elements } The problem is that I get an error

BitArray Slicing

2016-12-21 Thread Ezneh via Digitalmars-d-learn
Hi, in one of my projects I have to get a slice from a BitArray. I am trying to achieve that like this : void foo(BitArray ba) { auto slice = ba[0..3]; // Assuming it has more than 4 elements } The problem is that I get an error : "no operator [] overload for type BitArray". Is there any o