Forward reference to enum nested in a class

HOSOKAWA Kenchi hskwk at inter7.jp
Sat Nov 3 01:58:48 PDT 2007


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,





More information about the Digitalmars-d mailing list