Thread overview | |||||
---|---|---|---|---|---|
|
November 03, 2007 Forward reference to enum nested in a class | ||||
---|---|---|---|---|
| ||||
Dear Everyone, I have problem on reference to enum nested in a class from template difinition. class Foo { enum FooEnum {} } enum GlobalEnum {} class BarA(Foo.FooEnum T) {} // Error, Foo.FooEnum is forward referenced class BarB(T : GlobalEnum){} // OK class BarC { FooEnum t; // OK } I want to specialize class template BarA in each conditions listed in Foo.FooEnum closely related with class Foo. This trial, however, failed because of forward reference to Foo.FooEnum from BarA. I have avoided this problem in this way: enum FooEnum {} class Foo { alias .FooEnum FooEnum; } class BarD(Image.FooEnum T) {} Please let me know the way to resolve this probrem. I have no idea whether this problem should be avoided by such way or another. Sincerely, |
November 04, 2007 Re: Forward reference to enum nested in a class | ||||
---|---|---|---|---|
| ||||
Posted in reply to HOSOKAWA Kenchi | "HOSOKAWA Kenchi" <hskwk@inter7.jp> wrote in message news:fghd88$2eql$1@digitalmars.com... > Dear Everyone, > > I have problem on reference to enum nested in a class from template difinition. > > > class Foo > { > enum FooEnum {} > } > enum GlobalEnum {} > > class BarA(Foo.FooEnum T) {} // Error, Foo.FooEnum is forward referenced > class BarB(T : GlobalEnum){} // OK > class BarC > { > FooEnum t; // OK > } > > > I want to specialize class template BarA in each conditions listed in > Foo.FooEnum closely related with class Foo. > This trial, however, failed because of forward reference to Foo.FooEnum > from BarA. > I have avoided this problem in this way: > > > enum FooEnum {} > class Foo > { > alias .FooEnum FooEnum; > } > class BarD(Image.FooEnum T) {} > > > Please let me know the way to resolve this probrem. > I have no idea whether this problem should be avoided by such way or > another. It's a bug that's been in the language as long as I can remember. Walter deems it "too difficult to fix with too little reward." BS, I say. |
November 06, 2007 Re: Forward reference to enum nested in a class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley Wrote:
> "HOSOKAWA Kenchi" <hskwk@inter7.jp> wrote in message news:fghd88$2eql$1@digitalmars.com...
> > Dear Everyone,
> >
> > I have problem on reference to enum nested in a class from template difinition.
> >
> >
> > class Foo
> > {
> > enum FooEnum {}
> > }
> > enum GlobalEnum {}
> >
> > class BarA(Foo.FooEnum T) {} // Error, Foo.FooEnum is forward referenced
> > class BarB(T : GlobalEnum){} // OK
> > class BarC
> > {
> > FooEnum t; // OK
> > }
> >
> >
> > I want to specialize class template BarA in each conditions listed in
> > Foo.FooEnum closely related with class Foo.
> > This trial, however, failed because of forward reference to Foo.FooEnum
> > from BarA.
> > I have avoided this problem in this way:
> >
> >
> > enum FooEnum {}
> > class Foo
> > {
> > alias .FooEnum FooEnum;
> > }
> > class BarD(Image.FooEnum T) {}
> >
> >
> > Please let me know the way to resolve this probrem.
> > I have no idea whether this problem should be avoided by such way or
> > another.
>
> It's a bug that's been in the language as long as I can remember. Walter deems it "too difficult to fix with too little reward." BS, I say.
>
>
Thank you very much for the information.
Fortunately I have a alternative solution written above, so I won't care of this problem.
again, thanks.
|
Copyright © 1999-2021 by the D Language Foundation