The OpenD Programming Language

codepointSetTrie

A shorthand for creating a custom multi-level fixed Trie from a CodepointSet. sizes are numbers of bits per level, with the most significant bits used first.

Note: The sum of sizes must be equal 21.

template codepointSetTrie(sizes...)
codepointSetTrie
(
Set
)
(
Set set
)
if (
sumOfIntegerTuple!sizes == 21
)

Examples

{
    import std.stdio;
    auto set = unicode("Number");
    auto trie = codepointSetTrie!(8, 5, 8)(set);
    writeln("Input code points to test:");
    foreach (line; stdin.byLine)
    {
        int count=0;
        foreach (dchar ch; line)
            if (trie[ch])// is number
                count++;
        writefln("Contains %d number code points.", count);
    }
}

See Also

toTrie, which is even simpler.

Meta