help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Correct use of templated class'es inner structs/classes?


From: Tomas Ukkonen
Subject: Correct use of templated class'es inner structs/classes?
Date: Fri, 07 May 2004 12:54:55 +0300
User-agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux))

Hi

I'm currently trying to make my old code to compile with 
new gcc 3.4.0. It compiles correctly in 3.3.3 so I'm not
sure if this is compiler bug or not.


Code very close to a example below fails to compile
because gcc 3.4.0 complains:
"error:   expected a type got 'Y<T>::particle'"
at Y<T>::func()'s iterator declaration.


EXAMPLE
(I actually haven't tried to get this compile).
-----------------------------------

example.h:
  template <typename T>
  class Y{
    public:
    
    struct particle {
      OtherClass<T> data;
    };

    void func();
    
    std::vector<Y<T>::particle> list;
  }


example.cpp:
  template <typename T>
  void Y<T>::func(){
    typename std::vector<Y<T>::particle>::iterator i;
    
    i = list.begin();
    
    while(i != list.end()){
      // do something
    }
  }
--------------------------



TIA, 
Tomas Ukkonen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]