AA dsource project
Saaa
empty at needmail.com
Thu Nov 5 05:37:01 PST 2009
"dsimcha" <dsimcha at yahoo.com> wrote in message
news:hcspk0$pk5$1 at digitalmars.com...
>A few weeks ago I mentioned that I was going to create some kind of forum
>for
> people to post candidate associative array implementations to replace the
> current, much-despised implementation as the new "builtin" AA for D. It's
> now
> up at http://dsource.org/projects/aa/wiki/WikiStart . SVN write access
> should
> work for all registered dsource users. If you have an associative array
> implementation that you feel is a significant improvement over the current
> builtin and are able/willing to license it under the Boost license, please
> post it for comment.
>
> Also, if you have a good benchmark for AAs, please create a benchmarks/
> directory and submit it.
Slightly related, I recently looked at the typecons code and was a bit
surprised that the string to enum works by checking the string against all
possible enum elements.
Couldn't a compile time perfect hashed aa fix this? :)
private template enumParserImpl(string name, bool first, T...)
{
static if (first)
{
enum string enumParserImpl = "bool enumFromString(string s, ref "
~name~" v) {\n"
~enumParserImpl!(name, false, T)
~"return false;\n}\n";
}
else
{
static if (T.length)
enum string enumParserImpl =
"if (s == `"~T[0]~"`) return (v = "~name~"."~T[0]~"),
true;\n"
~enumParserImpl!(name, false, T[1 .. $]);
else
enum string enumParserImpl = "";
}
}
More information about the Digitalmars-d-announce
mailing list