Re: class does not want to get friends with another class

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

 



Another friend declaration gives an error message which is incorrect.


template <class T, int C> class classA;

template <class T, int C, classA<T,C> &instanceA> class classB;

template <class T, int C> class classA
{

  // error message on instantiation: too few template parameters (1 < 3)
  template <classA &instanceA> friend class classB;
  
  // incorrect error message: partial specialization claimed but not
apparent 
  // template <classA &instanceA> friend class classB<T,C,instanceA>;

private:
  int for_use_by_classB;

};

template <class T, int C, classA<T,C> &instanceA> class classB
{

  classB (int i) { instanceA.for_use_by_classB = i; }

};

// instantiation
template class classA<char,128>;

-- 
View this message in context: http://old.nabble.com/class-does-not-want-to-get-friends-with-another-class-tp29910278p29915294.html
Sent from the gcc - Help mailing list archive at Nabble.com.



[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