This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

inner class in template class


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]