Hello Walter,
retard wrote:
Sun, 07 Mar 2010 15:59:37 -0800, Walter Bright wrote:
BCS wrote:
I think (from context in other strands) that the OP was referring
to value, not type, pattern matching.
Value pattern matching is just a regular switch statement.
So what types does the regular switch accept in D 2 ?
I already posted the way to do type pattern matching.
I think what retard was asking was what types are legal as the argument for
a switch?
IIRC the list is: all the arithmetic types and the string types.
The value pattern matching that is being asked for would allow just about
anything that has a compile time literal syntax:
void fn(int[] ar)
{
switch(ar)
{
case [1,2,3]: ... break;
case [1,2,4]: ... break;
case [1,3,2]: ... break;
}
}
--
... <IXOYE><