Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Template standard typedef and forward declaration

Reply
Thread Tools

Template standard typedef and forward declaration

 
 
shaan
Guest
Posts: n/a
 
      07-01-2012
i have written following template program. It works on windows, solaris and linux. It give error in AIX. Does my following program comply with standard ?


template<class T> class Cursor;
template<class T>
class Container
{

friend class Cursor<T>;
public:
typedef class Cursor<T> MyCursor; //compilation error on AIX
Container()
{

}

private:

T _a[20];
} ;

template<class T>
class Cursor
{

public:
Cursor(Container<T> *c):
_c(c)
{

}


T Get()
{
return _c->_a[9];
}

private:

Container<T> *_c;
};

int main()
{

Container<int> c;
Cursor<int> r(&c);
r.Get();


return 0;
}
 
Reply With Quote
 
 
 
 
Marcel Müller
Guest
Posts: n/a
 
      07-01-2012
On 01.07.12 09.45, shaan wrote:
> i have written following template program. It works on windows, solaris and linux. It give error in AIX. Does my following program comply with standard ?


It shouldn'd be too much of work to post the error message, isn't it?


Marcel
 
Reply With Quote
 
 
 
 
shaan
Guest
Posts: n/a
 
      07-02-2012
On Jul 1, 2:06*pm, Marcel Müller <news.5.ma...@spamgourmet.org> wrote:
> On 01.07.12 09.45, shaan wrote:
>
> > i have written following template program. It works on windows, solarisand linux. It give error in AIX. Does my following program comply with standard ?

>
> It shouldn'd be too much of work to post the error message, isn't it?
>
> Marcel


This implementation works fine on AIX. I had wrongly implemented the
forward reference in production code. This code could be good example
for template class forward reference and typedef.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting template types from a typedef'd template declaration Adam Nielsen C++ 3 10-19-2007 09:54 AM
Problem forward declaration of "typedef struct" Mohammad Omer Nasir C++ 8 02-19-2007 04:46 PM
forward declaration vs. typedef Plok Plokowitsch C++ 2 05-30-2005 05:31 PM
forward declaration for typedef of unnamed structs Jordi Vilar C++ 5 02-18-2004 09:41 PM
forward declaration for typedef of unnamed structs Jordi Vilar C Programming 5 02-18-2004 09:41 PM



Advertisments