What is the problem with this use of templates?

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

 



Hi,

I try to run this problem in g++ but it doesn't compiles. What is the problem?

//---START---

#include <iostream>

enum DIREC { goUp, goDown };

class MyClass {
public:
  template <DIREC dir>
  void
  doSomething() {
    std::cout << "i'm doing something\n";
  }
};

template<class T>
class MyVector {
public:
  MyVector() {}
  void execute();

};

template<class T>
void MyVector<T>::execute() {
  T* hello = new T();
  hello->doSomething<goDown>();
  delete hello;
}


int main() {
  MyVector<MyClass> mv;
  mv.execute();
}

//---END---

Here is my g++ version.
g++ (GCC) 3.3.5  (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Thanks

--
Javier Andrés Mena Zapata
University of  Valle
Cali - Colombia


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux