473,388 Members | 1,207 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,388 software developers and data experts.

How to remove dependency on a header file which has a typedef?

I have a header file say A.h in which I have typedefed

typedef std::vector<std::string> StringVector;

Now there is second file say B.h in which a class B has a method

class B {
....
ParseData(const StringVector::const_iterator& begin, const
StringVector::const_iterator& end);

};

Now without #including A.h in B.h, how can I declare
StringVector::const_iterator properly in B.h. I tried to do a forward
declaration in B.h but I get compilation errors.

// Following gives compilation errors if I put it in B.h
Class StringVector::const_iterator;

Thank you for your replies.

Vikas
Jul 19 '05 #1
1 3639
"Vikas" <vs*****@hotmail.com> wrote...
I have a header file say A.h in which I have typedefed

typedef std::vector<std::string> StringVector;

Now there is second file say B.h in which a class B has a method

class B {
...
ParseData(const StringVector::const_iterator& begin, const
StringVector::const_iterator& end);
.
};

Now without #including A.h in B.h, how can I declare
StringVector::const_iterator properly in B.h.
Put the typedef in C.h and #include C.h in both A.h and B.h.
I tried to do a forward
declaration in B.h but I get compilation errors.

// Following gives compilation errors if I put it in B.h
Class StringVector::const_iterator;


'Class' is not C++. 'class' would be C++. Although, there is no
forward-declaration of members in C++, anyway.

Victor
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Gordon Watts | last post by:
Hi there, I've got a special header file which I run an small external program over to produce a .cpp file that I want to have my project build. The special header file includes a second header...
11
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do...
2
by: trying_to_learn | last post by:
im in the primary stages of learning C++. The book im learning from says Dont use using namespace.. directive in header file However im trying to make the following header file.I need to include...
6
by: hercules | last post by:
Hi: In some code , I used typedef unsigned char BOOL; /*boolean */ But in other code , I must use typedef unsigned int BOOL; /* boolean */ How to remove the previous typedef ? ...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
3
by: fc2004 | last post by:
Hi, Is there any tools that could report where cyclic header dependency happens? this would be useful when working with a large project where tens or hundreds of headers files may form complex...
1
by: pallav | last post by:
I have two header files, circuit.h and latch.h that reference each other and are causing a cyclic dependency. latch.h file #include "circuit.h" typedef boost::shared_ptr<struct LatchLatchPtr;...
3
by: joshc | last post by:
I've found some old posts on this issue but the answer was a bit vague to me. The problem I am trying to solve is the following: /***** a.h ***********/ #include "b.h" /* Forward declaration...
1
by: vincentt | last post by:
Hi, We code DLL's and so far it was done using VS6.0. We are planning to migrate the VS.NET 2005 and use the VS6 VC++ code which generated the DLL to VS 2005 VC++.NET. However we donot plan to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.