digitalmars.D.learn - isRandomAccessRange!(const(size_t[])) is false ... ?
- Joseph Rushton Wakeling (6/6) Sep 12 2013 import std.range;
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (9/15) Sep 12 2013 That one is fine. You probably want a slice of const(size_t):
- H. S. Teoh (10/29) Sep 12 2013 [...]
import std.range; void main() { assert(isRandomAccessRange!(const(size_t[]))); } .... results in an assertion error. This is a bug, no ... ?
Sep 12 2013
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)[])); // <-- } Ali
Sep 12 2013
On Thu, Sep 12, 2013 at 03:12:48PM -0700, Ali Çehreli wrote:On 09/12/2013 02:53 PM, Joseph Rushton Wakeling wrote:[...] 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.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)[])); // <-- }
Sep 12 2013