workaround stable sort (std.move) not CTFE-able

This commit is contained in:
Dmitry Olshansky 2014-01-13 00:26:13 +04:00
parent 1c86ecf0c4
commit d0e408d5f4

View file

@ -2007,6 +2007,16 @@ public:
sanitize(); //enforce invariant: sort intervals etc. sanitize(); //enforce invariant: sort intervals etc.
} }
//helper function that avoids sanity check to be CTFE-friendly
private static fromIntervals(Range)(Range intervals)
{
auto flattened = roundRobin(intervals.save.map!"a[0]"(),
intervals.save.map!"a[1]"());
InversionList set;
set.data = Uint24Array!(SP)(flattened);
return set;
}
/** /**
Construct a set from plain values of code point intervals. Construct a set from plain values of code point intervals.
Example: Example:
@ -8576,7 +8586,7 @@ private:
@safe auto asSet(const (ubyte)[] compressed) @safe auto asSet(const (ubyte)[] compressed)
{ {
return CodepointSet(decompressIntervals(compressed)); return CodepointSet.fromIntervals(decompressIntervals(compressed));
} }
@safe pure nothrow auto asTrie(T...)(in TrieEntry!T e) @safe pure nothrow auto asTrie(T...)(in TrieEntry!T e)