Bug 9854 – Cannot directly subtype a type tuple

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-01T23:54:00Z
Last change time
2016-08-27T23:20:49Z
Keywords
rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-04-01T23:54:21Z
struct Tuple(Types...) { // Error: Types is not a member of Tuple alias Types this; // ok: workaround alias TypeTuple = Types; alias TypeTuple this; } void main() { alias T = Tuple!int; } A light-weight implementation of a Tuple: struct Tuple(Types...) { alias TypeTuple = Types; alias TypeTuple this; } alias Tuple! ( int ,Tuple!(float, string) ) list; void main() { pragma(msg, list[0]); pragma(msg, list[1]); pragma(msg, list[1][0]); pragma(msg, list[1][1]); }
Comment #1 by andrej.mitrovich — 2016-08-27T23:20:49Z
What was I thinking when I filed this. Multi-type subtyping doesn't work (yet), perhaps that was my end-goal. But that would require instances in any case.