Converting a list of words or array of values to variables at compile time
Louie F via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Nov 25 22:33:26 PST 2015
I found out that compile time optimization is quite useful
specially for database queries, instead of it being generated at
every call, it can be generated like I typed it using compile
time optimizations... so I thought,
Is it possible to convert an array of values or a list from a
file to variables or struct at compile time?
So basically I have a database, instead of writing a struct, I
would like to query the database for the list of tables and their
column information then parse that as a struct or variables for
parsing so that I could use it, so that if I delete or add
columns I then only need to recompile the code and not worry
about editing files...
class Users
{
/*
query the database and create fields at compile time
and use the variables below
*/
void create(){
this.name = "Louie";
}
}
or something like this...
foreach(table_names, key; table){
/*
generate struct using table and informations
*/
}
More information about the Digitalmars-d-learn
mailing list