On Sunday, 5 May 2013 at 01:44:19 UTC, bearophile wrote:
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
Is the behaviour of the empty [] when applied to tuples
documented anywhere?
The problem is that this doesn't work if the tuple is empty:
Error: template std.algorithm.canFind does not match any function
template declaration.
And unfortunately in the situation I need it for an empty tuple
is one of the most likely scenarios.