On Sunday, 13 September 2015 at 16:46:54 UTC, Laeeth Isharc wrote:
can I check if a member of a T has a member without using a mixin?hid_t createDataType(T)() if (__traits(isSame, TemplateOf!(T), PriceBar)) { auto tid=H5T.create(H5TClass.Compound,T.sizeof);enum offsetof(alias type, string field) = mixin(type.stringof ~"."~field~".offsetof"); H5T.insert(tid, "date", offsetof!(T,"date"), createDataType!(KalDate));static if(hasMember!(T,"open")) H5T.insert(tid,"open",offsetof!(T,"open"),mapDtoHDF5Type("double")); } I would like to check if date has a member called second. Thanks.
Use __traits(compiles, date.second)?
