[Issue 6365] New: AutoTupleDeclaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 23 05:01:01 PDT 2011


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

           Summary: AutoTupleDeclaration
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2011-07-23 05:00:58 PDT ---
Syntax:
'auto' '(' Identifier [',' Identifier ...] ')' '=' Initializer ';'

Example:
auto (num, msg) = TypeTuple!(1, "hello");  // built-in tuple
assert(num == 1);
assert(msg == "hello");

auto (name, age) = tuple("John", 10);  // library tuple (= alias this tuple)
assert(name == "John");
assert(age == 10);

auto (n1, n2) = 100;  // non tuple initializer
assert(n1 == 100);
assert(n2 == 100);

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


More information about the Digitalmars-d-bugs mailing list