Andrei Alexandrescu schrieb:
BLS wrote:
Look like this works... However it would be nice if we could place the
alias Tuple Pair stuff outside of foo()
I'm glad I waited a bit on that one :o). Nice work.
module tt;
import std.stdio;
import std.typecons;
//alias Tuple!(K, "key", V, "value") Pair; This don't work
It doesn't work because at that time the symbols K and V are not
visible. But this little simplification should work:
template Pair(K, V) {
alias Tuple!(K, "key", V, "value") Pair;
}
Andrei
Thanks :) Would be nice to have a Tuple return sample in the
std.typecons docs. IMO this a not very well known cool D2 feature.
Bjoern