On Thu, 03 Mar 2011 08:36:41 -0000, Ali Çehreli <acehr...@yahoo.com> wrote:

On 03/03/2011 12:21 AM, Peter Lundgren wrote:

 >>   >>  On 03/02/2011 08:56 PM, Peter Lundgren wrote:

 >>   >>>  struct MyStruct(T, T[] a) {
 >>   >>>        ...
 >>   >>>  }
 >>   >>>
 >>   >>>  but I receive the following error:
 >>   >>>
>> >>> Error: arithmetic/string type expected for value-parameter, not T[]

...

> That's closer, except I want to pass a value parameter (specifically, some compile > time instance of SomeContainer) instead of a type parameter, but that doesn't look
 > like it's supported.

I finally get it! :)

Yes, there are limitations for template value parameters. The spec at

   http://digitalmars.com/d/2.0/template.html#TemplateValueParameter

says:

<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>

So.. you could pass your alphabet in a string, then split it into characters internally. For example.

R

Reply via email to