http://d.puremagic.com/issues/show_bug.cgi?id=6365



--- Comment #38 from bearophile_h...@eml.cc 2011-11-18 18:10:20 PST ---
See also bug 4579

------------------

Another handy sub-feature. Sometimes you have tuples with N items, but you only
want to unpack some of them. This syntax doesn't work because "_" is a valid
variable name (and even if there's only one of them I don't want to define a
"_" variable):

auto t = tuple(1, 2.5, "hello", 'Z');
immutable (x1, void, s1, void) = t; // only x1 and s1 constants are created


Some "dontcare" syntax like that void is useful for issue 596 too:


import std.typecons: Tuple;
alias Tuple!(int, "x", int, "y") Foo;
void main() {
    auto f = Foo(1, 2);
    switch (f) {
        case Foo(1, void): break; // any Foo with x==1, don't care y
        default: break;
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to