473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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
2 6090
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Marcin Kalicinski | last post by:
Hi, Should the below code compile according to C++ standard? namespace N { struct S{ }; } void S() { } using N::S; It seems that various compilers behave differently with it. I found the...
5
by: Nomak | last post by:
Hello all, i have two template classes which needs each other. I tried to write some fwd decl / decl / impl in a good way but i can't get it to compile. Explanations: - .hh files are for...
2
by: Bryan Parkoff | last post by:
MPU_Group is the namespace and MPU is the struct. Three members: A, B, and C are in the MPU struct inside MPU_Group namespace. I tried to compile, but it shows error saying MPU struct is not...
1
by: Bryan Parkoff | last post by:
I know how to write "Pointer to Function" inside struct or class without using static, but I have decided to add static to all functions inside struct or class because I want member functions to be...
5
by: anonymous | last post by:
I have a Lex file containing definitions of 2 structures like: %{ struct a {...}; struct b { struct a i; ... }; struct a x;
3
by: Steve Richter | last post by:
I have a .cs file that contains the c# script of a page: <script language="c#" runat=server src="item.cs"/> The file item.cs contains c# code that contains a namespace: namespace ItemPages {...
11
by: rherring | last post by:
Hello, I have some C++ code that builds against 2 headers files that contain the same function name declaration (gethostname). The header files are not directly included. They are included via...
1
by: toton | last post by:
Hi, I have two namespace contains class InkFrame and PrefDialog respectively. PrefDialog needs InkFrame to show the dialog over the frame. It also stores a pointer to InkFrame inside it. Now I...
11
by: Jef Driesen | last post by:
I have the following problem in a C project (but that also needs to compile with a C++ compiler). I'm using a virtual function table, that looks like this in the header file: typedef struct...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.