How is `auto` and not `alias` appropriate for alias sequences?
Shriramana Sharma via Digitalmars-d
digitalmars-d at puremagic.com
Fri Dec 11 03:18:39 PST 2015
Hello. I just found that the following code compiles without any problem:
struct Foo { int val; string name; }
Foo foo = {1, "one"};
auto t = foo.tupleof;
Trying to use `alias` i.o. `auto` above fails.
Now IIUC, trying to take the address of t fails, so it's still a compile-
time-only construct without "real" i.e. runtime existence. The tuple is in
fact an AliasSeq, no? In which case, I would have thought that `alias` (for
compile-time symbols) and not `auto` (for runtime variables) would be the
appropriate choice.
Can someone please explain this situation? Thanks.
--
Shriramana Sharma, Penguin #395953
More information about the Digitalmars-d
mailing list