mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 23:50:31 +03:00
makeIndex: fix special case for uint
This commit is contained in:
parent
54bda1e5bc
commit
2267cf2620
1 changed files with 5 additions and 1 deletions
|
@ -994,7 +994,7 @@ if (isRandomAccessRange!Range && !isInfinite!Range &&
|
||||||
"r and index must be same length for makeIndex.");
|
"r and index must be same length for makeIndex.");
|
||||||
static if (IndexType.sizeof < size_t.sizeof)
|
static if (IndexType.sizeof < size_t.sizeof)
|
||||||
{
|
{
|
||||||
enforce(r.length <= size_t(IndexType.max + 1), "Cannot create an index with " ~
|
enforce(r.length <= size_t(1) + IndexType.max, "Cannot create an index with " ~
|
||||||
"element type " ~ IndexType.stringof ~ " with length " ~
|
"element type " ~ IndexType.stringof ~ " with length " ~
|
||||||
to!string(r.length) ~ ".");
|
to!string(r.length) ~ ".");
|
||||||
}
|
}
|
||||||
|
@ -1066,6 +1066,10 @@ if (isRandomAccessRange!Range && !isInfinite!Range &&
|
||||||
byte[128] sindex = void;
|
byte[128] sindex = void;
|
||||||
iota(128).makeIndex(sindex[]);
|
iota(128).makeIndex(sindex[]);
|
||||||
assert(sindex[].equal(iota(128)));
|
assert(sindex[].equal(iota(128)));
|
||||||
|
|
||||||
|
auto index2 = new uint[10];
|
||||||
|
10.iota.makeIndex(index2);
|
||||||
|
assert(index2.equal(10.iota));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Merge(alias less = "a < b", Rs...)
|
struct Merge(alias less = "a < b", Rs...)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue