indexing stuff during compile time

Eric nil at example.com
Sun Dec 24 23:46:34 UTC 2017


> I am just a bit confused why I had to use tuple() while the doc

Because of the enum, that code was full of errors :/
Got it now:

auto groupIndex(Ts...)() {
	import std.meta;
	import std.algorithm.comparison : cmp, strcmp = cmp;
	enum Comp(N1, N2) = strcmp(N1.stringof,  N2.stringof);
	alias sorted = staticSort!(Comp, Ts);
	return GroupId!sorted.id;
}



More information about the Digitalmars-d-learn mailing list