static foreach / How to construct concatenated string?

Robert M. Münch robert.muench at
Sat Mar 7 16:30:59 UTC 2020

I want to create a "CREATE TABLE data (...)" where the columns are 
derived from struct member names. Something like:

string s = "CREATE TABLE data(";

static foreach(f; FieldNameTuple!myStruct) {
  s ~= f ~ ",";

s ~= ");";

Which of course doesn't work... I didn't find any reference how to 
build-up strings in a statif foreach loop.

Is this possible at all?

Robert M. Münch
smarter | better | faster

More information about the Digitalmars-d-learn mailing list