By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,382 Members | 1,688 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,382 IT Pros & Developers. It's quick & easy.

Declaration of a struct inside namespace

P: n/a
Hi all,

Imagine I have (with respective header guards):
foo.h :
namespace foo_ { struct foo {... }; };

Then I can:
bar.h:
#include "foo.h"

struct bar {
...
foo_::foo *xpto;
};

Well, but if I don't want to include foo.h and If foo was not inside
namespace foo_, I could just remove the include directive and replace
it by class foo;. However, since it is inside a namespace, is there to
do this to avoid header inclusion?

Regards,

Paulo Matos

Nov 12 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 12 Nov 2006 08:29:26 -0800, "Paulo Matos" wrote:
>Imagine I have (with respective header guards):
foo.h :
namespace foo_ { struct foo {... }; };

Then I can:
bar.h:
#include "foo.h"

struct bar {
...
foo_::foo *xpto;
};

Well, but if I don't want to include foo.h and If foo was not inside
namespace foo_, I could just remove the include directive and replace
it by class foo;. However, since it is inside a namespace, is there to
do this to avoid header inclusion?
namespace foo_ { struct foo; };
struct bar {
...
foo_::foo *xpto;
};

Best wishes,
Roland Pibinger
Nov 12 '06 #2

P: n/a

Roland Pibinger escreveu:
namespace foo_ { struct foo; };
struct bar {
...
foo_::foo *xpto;
};
Argh, you're right! Thank you.
Best wishes,
Roland Pibinger
Nov 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.