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