Arbitrary Size Integer Arrays

Don nospam at nospam.com
Thu Sep 24 00:03:07 PDT 2009


Walter Bright wrote:
> Don wrote:
>> If you provide slice access (eg, give me elements [a..b] as an array 
>> of ints) then you can have reasonable performance. Unpacking 
>> consecutive elements can be done quite efficiently (it's an 
>> interesting optimisation problem, though!).
> 
> It wouldn't be slicable because a slice would have to start at the 
> beginning of a byte. The D bit type died in that quagmire.
And std::vector<bool>.
I didn't mean an actual D slice -- I meant value semantics, not 
reference semantics. Give me a copy of X[a..b], putting it into an int[] 
array.
Something like:

struct ArbitrarySizedIntArray
{
int[] extractSlice(size_t a, size_t b, int [] dest=null)
{
}

}




More information about the Digitalmars-d mailing list