473,406 Members | 2,956 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.

friends and templates

code sample:

template <class T> class Class1;
class Class2
{
template <class T> friend class Class1; //error
//private data
};
template <class T> class Class1
{
//
};

what is the solution ??, i'm using vc6 sp5.
Apr 6 '07 #1
1 903
weaknessforcats
9,208 Expert Mod 8TB
This compiles fine using Visual Sutdio.NET 2005.

VC6 has template problems evern with the servuice packs applied.
Apr 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Gianni Mariani | last post by:
I have 2 distinct template classes which co-operate, hence are friends. However, I can't seem to figure out what syntax to use to make this work. What is the right(tm) way to write a friend...
6
by: Roger Leigh | last post by:
I've written a fixed-precision class, "numeric". This stores the number of decimal places as a template parameter. I've overloaded all of the normal numerical operators (an example): ...
10
by: william xuuu | last post by:
Actually, I also got linker errors with template functions and template classes. And I avoided both of them successfully, by pouring foo.cpp into foo.h, according to the C++ FAQ. ...
7
by: fabio de francesco | last post by:
Hello, I'm just joking with the Subject, but I really don't know how to make a synthesis of two questions about some code I'm trying to write. In the following I post this little code, with...
1
by: Tom McCallum | last post by:
Hi, Can someone please tell me the correct syntax (if its possible of course) to specify an output stream operator for a templated class so that I dont need to write the same function for all...
11
by: Micha | last post by:
Hello there, I think I've run into some classic c++ pitfall and maybe some of you guys can help me out. For my project I will need to use matrices and vectors and so I decided to implement them...
9
by: Klaas Vantournhout | last post by:
Hi all, I have a question about friends functions of a template class. To make it simple, I would like to do something like this. Assume that I have a class foo with template T ...
6
by: Andrey Tarasevich | last post by:
Hello Consider the following code fragment namespace N { struct S { void foo(); }; }
4
by: StephQ | last post by:
According to: http://www.parashift.com/c++-faq-lite/templates.html#faq-35.4 , if my understanding is correct, in template<typename T> class Foo { friend void func (const Foo<T>& foo); }; ...
5
by: emboss | last post by:
If templates worked how I would like them to work, I'd be able to do the following: template <int N> class A { private: int X; public: template <int M> void foo(const A<M>...
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
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
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...
0
agi2029
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,...
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.