Hi all :)
I have an-easy-to-resolve (I am sure but I am obviously unable to
figure the answer out) problem for C++ gurus.
Here's the situation I have fallen into...
2 header files: H1.h & H2.h
--------------------------------------------------------------------
--- H1.h
--------------------------------------------------------------------
#include "H2.h" // <------ error at compilation (unknown type:
T1c in the T2),
// without the #include: unknown
type T2 in the T11
class T11
{
<...>
T2 method();
}
template <typename Tclass T12 :
: T11
{
<...>
}
typedef T1<charT1c;
--------------------------------------------------------------------
--- H2.h
--------------------------------------------------------------------
#include "H1.h"
class T2
{
<...>
void method(T1c);
}
--------------------------------------------------------------------
Is it possible to resolve the conflict described? Or should I find a
way to avoid this kind of cross calls?
Thanks for any help :) 6 1677 Ma************* **@gmail.com wrote:
I have an-easy-to-resolve (I am sure but I am obviously unable to
figure the answer out) problem for C++ gurus.
Here's the situation I have fallen into...
2 header files: H1.h & H2.h
--------------------------------------------------------------------
--- H1.h
--------------------------------------------------------------------
#include "H2.h" // <------ error at compilation (unknown type:
T1c in the T2),
// without the #include: unknown
type T2 in the T11
class T11
{
<...>
T2 method();
Change to
class T2 method();
}
template <typename Tclass T12 :
: T11
{
<...>
}
typedef T1<charT1c;
--------------------------------------------------------------------
--- H2.h
--------------------------------------------------------------------
#include "H1.h"
class T2
{
<...>
void method(T1c);
Change to
void method(class T1c);
}
--------------------------------------------------------------------
Is it possible to resolve the conflict described? Or should I find a
way to avoid this kind of cross calls?
You don't have to avoid them. Read about forward declarations.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
I have replaced
void method(T1c);
by
void method(T1<char> );
Is it a good decision? Ma************* **@gmail.com wrote:
I have replaced
void method(T1c);
by
void method(T1<char> );
Is it a good decision?
Any decision that moves you closer to your goal is good.
On 11 , 15:11, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
Mail.To.Nathan. ..@gmail.com wrote:
I have replaced
void method(T1c);
by
void method(T1<char> );
Is it a good decision?
Any decision that moves you closer to your goal is good.
It could be an "it-works-but-you-should-never-do-this" solution :)
Anyway, :D Ma************* **@gmail.com wrote:
On 11 , 15:11, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
>Mail.To.Nathan ...@gmail.com wrote:
>>I have replaced void method(T1c); by void method(T1<char> );
>>Is it a good decision?
Any decision that moves you closer to your goal is good.
It could be an "it-works-but-you-should-never-do-this" solution :)
OK, I took another look and think that your solution does not really
fall into that category. However, there is something to be said, of
course. 'T1c' is a typedef in the header you didn't (or couldn't)
include. Why is it a typedef? At some point the decision was made
to have a typedef instead of forcing the user type 'T1<char>'. Was
that to save typing or was there other reason? If it was to save
typing, replacing 'T1c' with 'T1<char>' in the declaration above is
perfectly OK. However, if it was because on some systems 'T1c' can
be something else (and not necessarily 'T1<char>'), and the choice
has to be governed by some #define or whatever other means, then
being explicit here may not be what you need. The latter case is,
admittedly, unlikely.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
It was only a user-confort choice allowing for shorter type names. So
everything seems OK now.
Thank you really very much for your help and attention.
Spasibo :)
On 11 , 16:02, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
Mail.To.Nathan. ..@gmail.com wrote:
On 11 , 15:11, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
Mail.To.Nathan. ..@gmail.com wrote: I have replaced void method(T1c); by void method(T1<char> );
>Is it a good decision?
Any decision that moves you closer to your goal is good.
It could be an "it-works-but-you-should-never-do-this" solution :)
OK, I took another look and think that your solution does not really
fall into that category. However, there is something to be said, of
course. 'T1c' is a typedef in the header you didn't (or couldn't)
include. Why is it a typedef? At some point the decision was made
to have a typedef instead of forcing the user type 'T1<char>'. Was
that to save typing or was there other reason? If it was to save
typing, replacing 'T1c' with 'T1<char>' in the declaration above is
perfectly OK. However, if it was because on some systems 'T1c' can
be something else (and not necessarily 'T1<char>'), and the choice
has to be governed by some #define or whatever other means, then
being explicit here may not be what you need. The latter case is,
admittedly, unlikely.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Roedy Green |
last post by:
In a spreadsheet you can arrange that column headers are always
visible no matter how much your scroll the table itself. What is the
best way to get this effect in CSS?. Does it require frames or is
there a better way?
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
|
by: sam |
last post by:
Hello Group,
Havent had luck posting it to
microsoft.public.dotnet.framework.aspnet.datagridcontrol group. Excuse
me for the cross posting.
I have a datagrid which needs to be split into multiple
pages when printing along with headers on every page. I came up with
this routine below which adds 2 rows - one with datagrid headers and
the other is also a headers which consists other related information.
The 2 rows(headers) needs to be...
|
by: Christopher Benson-Manica |
last post by:
At what point was the .h dropped from the STL headers? I just had a
discussion yesterday with my boss, who said he wanted .h on all the
STL includes, despite me protesting that it was not standard...
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
|
by: Dave |
last post by:
Hello NG,
It is well known that memory-allocating definitions should not be put in a
header file. I believe, however, that this does not apply to const
definitions. For example:
#ifndef MY_HEADER
#define MY_HEADER
const int FOO = 42;
|
by: John M |
last post by:
I know that you can make a cross tab query and get the fields as headers but
it makes the form or datasheet unusable, ie cant add any data in the
resulting fields. Is there a way of making a table with fields, from another
table, that can then be used as headers so you can use the resulting fields
for data entry. I only need this for forward planning and the data entered
would be changed regularly, but not continually added to. I also would...
| |
by: Jeff Rodriguez |
last post by:
Here's what I want do:
Have a main daemon which starts up several threads in a Boss-Queue structure.
From those threads, I want them all to sit and watch a queue. Once an entry
goes into the queue, grab it and run a system command.
Now I want to make sure that system command doesn't hang forever, so I need some
way to kill the command and have the worker thread go back to work waiting for
another queue entry.
|
by: cooltech77 |
last post by:
Hi,
I am trying to build the following functionality in the datagrid.
I have a lot of columns in the datagrid which are being populated from the
database and the user needs to scroll horizontally to view these coloumn
names.
So I want to group them into
categories which will fit into a page.
A user clicks a category and the category should
|
by: evanpmeth |
last post by:
I am currently working a program that was intended to be purely JS and
AJAX. Due to the cross domain access problems i have defaulted to a
language I enjoy more, Python. My project consists of a web service
that provides information from a site that can only be accessed through
a portal type system. The information is retrieved by a python script
then relayed to the web browser. This information is behind a simple
username and password...
|
by: Maart_newbie |
last post by:
Hi all,
Can anyone tell me how I can include one header Form1.h into another
header Form2.h and the other way around without evolving into compile
errors? Both headers contain only one class in which I want to declare
an instance of the class in the other header file.
I assume that through some circulair reference this won't work, but I
don't know how otherwise to be able to declare the instances. The
compile error that I receive is:
|
by: ADT_CLONE |
last post by:
I am having trouble with headers at the moment. Here is the code for a
start:
body.h:
#pragma once
#ifndef BODY_H
#define BODY_H
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |