handful and interval

Philippe Sigaud philippe.sigaud at gmail.com
Sun Sep 2 12:58:41 PDT 2012


On Sun, Sep 2, 2012 at 5:29 PM, Dmitry Olshansky <dmitry.olsh at gmail.com> wrote:

> I wouldn't question utility but rather the implementation of the above.
> One thing I'd love to see is thing like
> handful!("struct", "class", "union")
>
> that does pre-process contents at compile time to speed up search.
> In other words it's possible to not only come close to  a series of a ==
> "struct" || a == "class" || a == "union" but surpass it.

Dmitry, don't you have a trie implementation since your GSOC project?

In any case, I'd gladly welcome such a function. I just spent hours
trying to find an quick way to search for a string among a handful
(set, group, whatever) of strings known at CT, that works at
compile-time and is swift at runtime. Having that in Phobos would be
very nice.
For strings, some ordering and prefix factorisation can probably work,
but what Andrei proposes is more general I presume?


More information about the Digitalmars-d mailing list