version specific enum members

Ary Borenszweig ary at esperanto.org.ar
Fri Oct 30 04:38:44 PDT 2009


Phil Deets wrote:
> On Thu, 29 Oct 2009 18:28:12 -0500, Ary Borenszweig 
> <ary at esperanto.org.ar> wrote:
> 
>> Ellery Newcomer wrote:
>>> Phil Deets wrote:
>>>> Hi, is there a way to add members to an enum based on conditional
>>>> compilation symbols. I tried
>>>>
>>>> enum Tag {
>>>>    A, B,
>>>>    version (symbol) {
>>>>       C, D,
>>>>    }
>>>>    E,
>>>> }
>>>>
>>>> but it doesn't work. I know I could do
>>>>
>>>> version (symbol) {
>>>>    enum Tag { A, B, C, D, E }
>>>> } else {
>>>>    enum Tag { A, B, E }
>>>> }
>>>>
>>>> but I don't want to do that since in my case, there can be quite a few
>>>> elements outside of the version, and I don't want to repeat them all.
>>>>
>>>>
>>>  Unfortunately, that's going to be about the best you can do, unless
>>> you're willing to play with string mixins and their ilk.
>>
>> Or unless you create an enhancement request. That seems a very valid one.
> 
> Done (on the main D list).

I meant a bugzilla enhancement, otherwise it'll get lost in the newsgroups.


More information about the Digitalmars-d-learn mailing list