Defining constant values in struct

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 16 14:46:33 PDT 2015


On Tuesday, 16 June 2015 at 21:38:22 UTC, jklp wrote:
> On Tuesday, 16 June 2015 at 21:17:37 UTC, tcak wrote:
>> [...]
>
> Do i miss a detail in your requirement ?
>
> ---
> struct TableSchema{
> 	const string TABLE = "users";
>
> 	struct FieldTypes{
> 		static const string ID = "BIGINT";
> 	}
>
> 	const string CREATESQL = "... id " ~ FieldTypes.ID ~ "...";
> }
> ---
>
> because this works.

Hmm, I never defined it as `static const` before. Tried with 
`static shared` only. Yes, it works like this.


More information about the Digitalmars-d-learn mailing list