Generating members from parameter tuple
Brad Anderson
eco at gnuk.net
Sun Aug 18 23:56:22 PDT 2013
import std.typetuple;
struct S(T...)
{
alias Types = T;
}
alias Si = S!(int, short);
alias Sf = S!(float, double);
template STypes(STy) { alias STypes = STy.Types; }
struct B(Ss...)
{
alias CombinedTypes =
NoDuplicates!(TypeTuple!(staticMap!(STypes, Ss)));
// I'd like to create a member here for every type in
CombinedTypes
// that is an array of each type. e.g.,
// int[] _intArray;
// short[] _shortArray;
// float[] _floatArray;
// double[] _doubleArray;
//
// I don't believe the names matter because I'd probably want
// to use a templated method that returns the appropriate
// member based on the type supplied (e.g., getArray!int(),
// getArray!short(), etc.)
}
More information about the Digitalmars-d-learn
mailing list