Connecting Tech Pros Worldwide Forums | Help | Site Map

Forward declaration of a nested class

Jiri Palecek
Guest
 
Posts: n/a
#1: Jul 22 '05
Hi
How can I (can I?) forward declare a nested class without having
to define the class it is nested in? Like this

class A;
class A::B;
void f(A::B*);

Thanks in advance

Jiri Palecek
japeleck at web dot de

Victor Bazarov
Guest
 
Posts: n/a
#2: Jul 22 '05

re: Forward declaration of a nested class


Jiri Palecek wrote:[color=blue]
> How can I (can I?) forward declare a nested class without having
> to define the class it is nested in?[/color]

You cannot.
Jonathan Turkanis
Guest
 
Posts: n/a
#3: Jul 22 '05

re: Forward declaration of a nested class



"Jiri Palecek" <jpalecek@web.de> wrote in message
news:cf944ec6.0407261241.4a27ce52@posting.google.c om...[color=blue]
> Hi
> How can I (can I?) forward declare a nested class without having
> to define the class it is nested in? Like this
>
> class A;
> class A::B;
> void f(A::B*);
>
> Thanks in advance[/color]

One possible workaround is to define f to be a template

template<typename T>
void f(T*);

where f only relies on properties of T which A::B is known to satisfy.
If f(A::B) must coexist with other overloads of f(), you might be able
to use boost::enable_if.

Jonathan


Closed Thread