Template standard typedef and forward declaration

S

shaan

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;
}
 
M

Marcel Müller

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
 
S

shaan

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top