Parameterized Structs

Steven Schveighoffer schveiguy at yahoo.com
Thu Mar 3 06:18:49 PST 2011


On Thu, 03 Mar 2011 06:25:36 -0500, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Ali Çehreli:
>
>> <quote>
>> Template value parameter types can be any type which can be statically
>> initialized at compile time, and the value argument can be any
>> expression which can be evaluated at compile time. This includes
>> integers, floating point types, and strings.
>> </quote>
>
> I have needed arrays as template specialization arguments few times (I  
> have used alias to solve the problem). Allowing strings but not arrays  
> is one limitation that I don't understand.

An array literal is a runtime-initialized entity, much to the chagrin of  
Don and others (like myself).

There have been several pushes to try and get Walter to change array  
literals to immutable compile-time things, but it has so far not been  
accepted.

-Steve


More information about the Digitalmars-d-learn mailing list