467,889 Members | 1,406 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,889 developers. It's quick & easy.

Declaration of a struct inside namespace

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
  • viewed: 5212
Share:
2 Replies
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

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.

Similar topics

4 posts views Thread by Marcin Kalicinski | last post: by
2 posts views Thread by Bryan Parkoff | last post: by
1 post views Thread by Bryan Parkoff | last post: by
5 posts views Thread by anonymous | last post: by
3 posts views Thread by Steve Richter | last post: by
11 posts views Thread by rherring | last post: by
11 posts views Thread by Jef Driesen | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.