Skip to content

Commit

Permalink
fix MirStringTable
Browse files Browse the repository at this point in the history
  • Loading branch information
9il committed Jan 27, 2021
1 parent 4a47876 commit 801e332
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/mir/string_table.d
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ struct MirStringTable(size_t length, size_t maxKeyLength, bool caseInsensetive =
The constructor uses GC.
It can be used in `@nogc` code when if constructed in compile time.
+/
this()(immutable(C)[][length] sortedKeys)
this(immutable(C)[][length] sortedKeys)
@trusted pure nothrow
{
pragma(inline, false);
Expand Down Expand Up @@ -231,7 +231,11 @@ package template createTable(C)
auto createTable(immutable(C)[][] keys, bool caseInsensetive = false)()
{
static immutable C[][] sortedKeys = prepareStringTableKeys!caseInsensetive(keys);
return MirStringTable!(keys.length, sortedKeys.length ? sortedKeys[$ - 1].length : 0, caseInsensetive, C)(sortedKeys[0 .. sortedKeys.length]);
alias Table = MirStringTable!(sortedKeys.length, sortedKeys.length ? sortedKeys[$ - 1].length : 0, caseInsensetive, C);
static if (sortedKeys.length)
return Table(sortedKeys[0 .. sortedKeys.length]);
else
return Table.init;
}
}

Expand Down

0 comments on commit 801e332

Please sign in to comment.