I have an array of structs eg

struct PriceBar
{
  DateTime date;
  double open;
  double high;
  double low;
  double close;
}

(which fields are present in this particular struct will depend on template arguments).

what is the best way to turn these at compile time into a struct of arrays? eg

struct PriceBars
{
  DateTime[] dates;
  double[] opens;
  double[] highs;
  double[] lows;
  double[] closes;
}

I can use FieldTypeTuple and FieldNameTuple, but I am a bit lost as to how without static foreach to loop through these in order to generate a mixin to declare the new type. I can turn it into a string, but what is the better option?

Thanks.

Reply via email to