View source code Display the source code in std/uni.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.uni.codepoint_set_trie - multiple declarations

Template 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.

Arguments

template codepointSetTrie(sizes...);

Functions

Function name Description
codepointSetTrie

Note

The sum of sizes must be equal 21.

See Also

toTrie, which is even simpler.

Example

{
    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);
    }
}

Alias CodepointSetTrie

Type of Trie generated by codepointSetTrie function.

Declaration

alias CodepointSetTrie(sizes...) = typeof(TrieBuilder!(bool,dchar,lastDchar+1,Prefix)(false).build());

Authors

Dmitry Olshansky

License

Boost License 1.0.

Comments