Thread View: comp.std.c++
1 messages
1 total messages
Started by Aaron Emigh
Mon, 17 Aug 1992 23:01
Accessing nested classes from friend functions
Author: Aaron Emigh
Date: Mon, 17 Aug 1992 23:01
Date: Mon, 17 Aug 1992 23:01
36 lines
1723 bytes
1723 bytes
I was trying to write a friend function of a template class containing
another class taking a pointer to the internal class as an argument, and
couldn't find any way to get my compiler (Borland C++ 3.0) to accept it.
I couldn't find anything clear in my documentation, so I'm wondering if
there is a defined syntax for doing this.
In case I'm not being clear, here's an example of what I mean (semantic
content has been reduced to null in the interests of brevity).
// A do-nothing template class containing only another class and a
// friend function, for demonstration purposes.
template <class type_instance_t>
class class_t {
class internal_t {
type_instance_t foo;
};
friend void frob_class (internal_t *);
};
// Here's the question: how do I declare a friend function that takes a
// class nested inside a template class as an argument?
template <class type_instance_t>
void frob_class (class_t<type_instance_t>::internal_t *arg)
{
}
For my application, declaring internal_t separately and making
class_t its friend works fine, but is less correct in terms of the
operations I am supporting. Is there a defined way of implementing this
with the class definitions nested?
Aaron Emigh
aaron@iit.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads