inner class in template class

Levente Farkas !spam-lfarkas@mindmaker.hu
Tue Aug 3 02:48:00 GMT 1999


hi,
is it a correct code or just the compilers can understand me ?:
(the intresting part are in comment:-))
---------
#include <iostream>
using namespace std;

template <class T>
class A
{
public:
  class B
  {
  public:
    T i;
  };
  T j;
};
/*
template<class T, class Ty = char, class Trail = char_traits<Ty> >
inline basic_ostream<Ty, Trail> & __cdecl
operator<<(basic_ostream<Ty, Trail> & stream, const A<T>::B & b)
{
  return stream << b.i;
}

template<class T>
ostream& operator<<(ostream& stream, const A<T>::B & b)
{
  return stream << b.i;
}
*/
ostream& operator<<(ostream& stream, const A<int>::B & b)
{
  return stream << b.i;
}

void main()
{
  A<int>::B b;
  cout << b;
}
---------
 -- Levente


More information about the Gcc-bugs mailing list