On Thu, Sep 12, 2013 at 03:12:48PM -0700, Ali Çehreli wrote: > On 09/12/2013 02:53 PM, Joseph Rushton Wakeling wrote: > >import std.range; > > > >void main() > >{ > > assert(isRandomAccessRange!(const(size_t[]))); > >} > > > >.... results in an assertion error. This is a bug, no ... ? > > That one is fine. You probably want a slice of const(size_t): > > import std.range; > > void main() > { > assert(!isRandomAccessRange!(const(size_t[]))); > assert( isRandomAccessRange!(const(size_t)[])); // <-- > } [...]
Explanation: const(size_t)[] means the elements of the array can't be modified, but the array itself can (necessary to implement popFront, popBack, etc.). const(size_t[]) means the array itself can't be modified, so popFront, popBack are invalid. So it cannot be a range. T -- Food and laptops don't mix.