BitArray/BitFields - Review
Jonathan M Davis
jmdavisProg at gmx.com
Sat Jul 28 14:07:19 PDT 2012
On Sunday, July 29, 2012 00:58:59 Dmitry Olshansky wrote:
> My solution is make slices different type e.g. BitSlice.
> It's always reference to the original BitArray. Array itself still can
> be either compact or not. All operations with slice go to array (and
> still check if they can use word-aligned speed up).
>
> How does it sound?
I would point out that while hasSlicing doesn't currently check for it, if
opSlice doesn't return a type which is assignable to the original range, it
won't work in a lot of Phobos functions. I keep meaning to bring that up for
discussion in the main newsgroup. I'd argue that hasSlicing really be changed
from
enum bool hasSlicing = !isNarrowString!R && is(typeof(
(inout int _dummy=0)
{
R r = void;
auto s = r[1 .. 2];
static assert(isInputRange!(typeof(s)));
}));
to something like
enum bool hasSlicing = !isNarrowString!R && is(typeof(
(inout int _dummy=0)
{
R r = void;
auto s = r[1 .. 2];
static assert(isInputRange!(typeof(s)));
r = s;
}));
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list