J
Juha Nieminen
If we want to pre-declare a class inside a namespace, that's easy:
namespace A { class B; }
void foo(const A::B*); // ok
However, assume that A is a class instead of a namespace. It would be
really nice if one could do something like:
class A;
class A::B; // error
void foo(const A::B*); // nope
Being able to do like this would reduce #include dependencies (which
in some cases are rather annoying).
Maybe there's another way of doing this I have missed? (Taking B out
of A is not a good option, as the whole purpose of it being inside A is
so that it doesn't garbage the outer namespace.)
It would also be nice if other types inside incomplete classes could
also be pre-declared, to reduce #include dependencies. For example:
class A;
enum A::SomeType;
void foo(A::SomeEnum type);
Or something similar.
namespace A { class B; }
void foo(const A::B*); // ok
However, assume that A is a class instead of a namespace. It would be
really nice if one could do something like:
class A;
class A::B; // error
void foo(const A::B*); // nope
Being able to do like this would reduce #include dependencies (which
in some cases are rather annoying).
Maybe there's another way of doing this I have missed? (Taking B out
of A is not a good option, as the whole purpose of it being inside A is
so that it doesn't garbage the outer namespace.)
It would also be nice if other types inside incomplete classes could
also be pre-declared, to reduce #include dependencies. For example:
class A;
enum A::SomeType;
void foo(A::SomeEnum type);
Or something similar.