Check if tuple contains value at compile time
bearophile
bearophileHUGS at lycos.com
Sat May 4 18:44:18 PDT 2013
Diggory:
> The documentation seems too say that "[mytuple]" will make an
> array,
Nope. You have to extract the inherent typetuple first. And this
is what the [] syntax does (tested):
import std.stdio, std.typecons, std.algorithm;
void main() {
auto t = tuple("foo", "bar", "spam");
assert([t[]].canFind("bar"));
}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list