Convert this C define to D

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Tue May 22 06:58:39 PDT 2007


Regan Heath wrote:
> Daniel Keep Wrote:
[snip]
>> Assuming that STACK is an actual type...
>>
>> template STACK_OF(type)
>> {
>>     alias STACK STACK_OF;
>> }
> 
> So, using the above this:
> 
> struct foo {
>   STACK_OF(Bob) bobStack;
> }
> 
> results in/becomes/is equivalent to this:
> 
> struct foo {
>   STACK  bobStack;
> }
> 
> ?
> 
> Yes, STACK is a type, a structure which has previously been defined.

Almost. You'd have to do this:
---
struct foo {
     STACK_OF!(Bob) bobStack;
}
---
Note the '!'.


More information about the Digitalmars-d-learn mailing list