Template help - MultiAccess

Philippe Sigaud philippe.sigaud at gmail.com
Tue Jan 8 12:59:39 PST 2013


On Tue, Jan 8, 2013 at 9:14 PM, Era Scarecrow <rtcvb32 at yahoo.com> wrote:

> On Tuesday, 8 January 2013 at 20:07:29 UTC, monarch_dodra wrote:
>
>> You appear to want "choice" to represent a value, rather than a type.
>>
>> Declare it as "int choice" or "alias choice"
>>
>> Not that with "int choice", you'll get a compiler error because it isn't
>> a compile constant. I'm not really sure about how "alias" works, but that's
>> the source of your problem.
>>
>
>  Ahh. I changed it and instantly it compiles. I never quite did understand
> alias for templates, but now I think I have a better grasp.
>

alias for templates gives you a 'symbol' parameter: you can pass any
identifier to it: variable, user-defined types, module names...
Not built-in types (int,...) which are keywords and *not* valid identifiers.

A single identifier in a template parameter list (usually marked with
UpperCase) denotes a type.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130108/d9c02ecb/attachment.html>


More information about the Digitalmars-d-learn mailing list