Re: template friend operator and template class: problem
From: Alwyn (dt015a1979_at_mac.com.invalid)
Date: 08/25/04
- Next message: WMFisher40: "Re: [OT]C++ Audio Interfaces"
- Previous message: Alwyn: "Re: template, typename and vector::iterator: why this error?"
- In reply to: Rui Maciel: "Re: template friend operator and template class: problem"
- Next in thread: Rui Maciel: "Re: template friend operator and template class: problem"
- Reply: Rui Maciel: "Re: template friend operator and template class: problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 25 Aug 2004 14:53:59 +0100
In article <412c9365$0$20797$a729d347@news.telepac.pt>, Rui Maciel
<rui_maciel@mail.com> wrote:
> Alwyn wrote:
> > In article <412baa96$0$1799$a729d347@news.telepac.pt>, Rui Maciel
> > <rui_maciel@mail.com> wrote:
> ><snip>
> >>template <typename U, unsigned int l1, unsigned int l2>
> >>bool operator==(const A<U, l1> &lhs, const A<U, l2> &rhs);
> >
> >
> > Do you need these declarations? I don't believe they contribute
> > anything to the code as it stands.
> >
> >
> >>template <typename T, int lines>
> >>class A {
> >> public:
> >> //snip
> >> template<typename U, int l1, int l2>
> >> friend bool operator==<U, l1, l2>(const A<U, l1> &lhs, const A<U, l2>
> >>&rhs); // line pointed by the error message
> >
> >
> > Shouldn't that be:
> > friend bool operator==(const A<U, l1> &lhs, const A<U, l2> &rhs);
> > ?
>
> You are absolutely right. The thing is, I started doing this template
> friend operator from a declaration of a friend template operator that
> used the template class parameters, which apparently needs all those
> forward declarations to work.
So it compiles for you now? I was afraid it might be a compiler
problem; not all of them support template friends yet.
Alwyn
- Next message: WMFisher40: "Re: [OT]C++ Audio Interfaces"
- Previous message: Alwyn: "Re: template, typename and vector::iterator: why this error?"
- In reply to: Rui Maciel: "Re: template friend operator and template class: problem"
- Next in thread: Rui Maciel: "Re: template friend operator and template class: problem"
- Reply: Rui Maciel: "Re: template friend operator and template class: problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|