This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

problem with inner classes in template functions


Dear peoply from the GNU-WIN32 project,
my name is Oliver Glier and I'm porting a C++ class library to
Windows. The code is already compilable by Borland C++,
Sun Sparc C++, and GCC 2.7 (EMX , Linux, and Sun).
My problem is that I would like to use your compiler (beta 1.8) ,
but it  doesn't accept the following construct:

template<class T>
class Container
{
public:
  class Iterator {
    public:
      void setnull();
  };
};

template<class C>
void createIterator(const C&)
{
  C::Iterator it;
  it.setnull();
}

void test()
{
  Container<int> numbers;
  createIterator(numbers);
}

The compiler always yields a syntax error at the line with
"C::Iterator it;" in function createIterator(). The funny thing is
that the compiler rejects the code before createIterator(
Container<int>) is generated, that is, while createIterator()
is nothing more than a raw template. Still, I think that
code as above is correct C++. At least it works with a lot
of other C++ compilers and seems to be important in the
use of class libraries such as STL.

Last but not least I must say that I'm very grateful for your
efforts of porting GNU C++ to Windows. You project is
great and I hope the best for its future.

With best regards,
Oliver.

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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