------- Additional Comments From jmoro at latentzero dot com  2005-02-17 10:47 
-------
I am sorry but that is not good enough. If I read correcly, you recommend that
to solve the problem with my template function member of a class is ... not to
use template functions as members of the class.

My example was indeed simple and you could get the template out of the class but
if I alter slightly B.h, you can see why I want g() to be a member of the class.

I can obviouly come up with solutions where I don't use member template
functions or even where I don't use templates at all but what I want to know is
how you are supposed to deal with this problem at hand.

What is the recommended way, with gcc 3.4, to deal with template methods and
circular dependencies?

Again, when I read a good C++ book, the solution is to use the export keyword
but GCC does not support it.

///////
// B.h
///////
class A;

class B
{
public:

  B(){}
  ~B(){}

  template <class T> int g( T t )
  {
    A * a = GetA();
    return ( a->getInt() + t );
  }

  int getInt() const
  {
    return 2;
  }
  
private:

  A * GetA();
  
};

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20011

Reply via email to