Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions std/uni.d
Original file line number Diff line number Diff line change
Expand Up @@ -2170,20 +2170,23 @@ public struct InversionList(SP=GcPolicy)

/**
Get range that spans all of the $(CODEPOINT) intervals in this $(LREF InversionList).
*/
@property auto byInterval() scope
{
// TODO: change this to data[] once the -dip1000 errors have been fixed
// see e.g. https://github.com/dlang/phobos/pull/6638
import std.array : array;
return Intervals!(typeof(data.array))(data.array);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this part of -dip1000 is still under work, so I presume it's best to do the ugly allocation for now, s.t. Walter can continue to work on DIP1000 and this stays @safe.

}

Example:
-----------
@safe unittest
{
import std.algorithm.comparison : equal;
import std.typecons : tuple;

auto set = CodepointSet('A', 'D'+1, 'a', 'd'+1);

assert(set.byInterval.equal([tuple('A','E'), tuple('a','e')]));
-----------
*/
@property auto byInterval() scope return
{
return Intervals!(typeof(data))(data);
}

package @property const(CodepointInterval)[] intervals() const
Expand Down Expand Up @@ -2791,7 +2794,7 @@ private:
// a random-access range of integral pairs
static struct Intervals(Range)
{
this(return scope Range sp) scope @trusted // FIXME
this(Range sp) scope
{
slice = sp;
start = 0;
Expand Down