Re: Constructing a tuple dynamically

2015-02-03 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 10:32:47 UTC, Pena wrote: How can I use this code or something similar to dynamically construct a tuple containing types of fields marked as @Cloneable? import std.traits, std.typetuple; template CloneableTypes(S) { template IsCloneable(string M) { enum Is

Re: Constructing a tuple dynamically

2015-02-03 Thread Kagamin via Digitalmars-d-learn
Try variadic templates with recursion. For example see http://dpaste.dzfl.pl/f49a97e35974

Constructing a tuple dynamically

2015-02-03 Thread Pena via Digitalmars-d-learn
I want to create a simple clone operator based on UDAs. First step is to create a tuple of the fields with desired UDA value and construct a clone method which uses that tuple. import std.traits; enum Cloneable; struct Foo { @Cloneable int cloneableInt; @Cloneable string cloneableStr;