Skip to content

Commit

Permalink
workaround stable sort (std.move) not CTFE-able
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryOlshansky committed Mar 8, 2014
1 parent 1c86ecf commit d0e408d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion std/uni.d
Expand Up @@ -2007,6 +2007,16 @@ public:
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.
Example:
Expand Down Expand Up @@ -8576,7 +8586,7 @@ private:

@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)
Expand Down

0 comments on commit d0e408d

Please sign in to comment.