alias tuples?

Manuel König ManuelK89 at gmx.net
Sun Oct 14 14:00:42 PDT 2007


Janice Caron wrote:
> I'm a little confused at how that works.
> 
> Surely, this.tupleof returns a type tuple - that is, a sequence of
> types? Surely then, the "a" in the foreach would be a type, not a
> member variable name? Surely then, a.serialize() would be calling each
> type's /static/ serialize() function, rather than the member function?
> 
> The goal is to call a function once for each actual struct member, not
> once for each member's type.
> 
> Am I completely misunderstanding this?

looking at http://www.digitalmars.com/d/tuple.html it says:

"The data fields of a struct or class can be turned into an _expression_ 
tuple using the .tupleof  property"
(below that you find an example that actually uses it)

I tested it myself and it works. I actually use it to implement 
functions in a generic matrix struct.

But http://www.digitalmars.com/d/tuple.html (section Struct Properties) 
states:

".tupleof Gets _type_ tuple of fields"

I think that's a typo and should be fixed.



More information about the Digitalmars-d mailing list