Re: specialization of member functions of class templates
From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 12/25/03
- Next message: Rob Williscroft: "Re: probs with a simple program"
- Previous message: Rob Williscroft: "Re: static member of class"
- In reply to: SainTiss: "specialization of member functions of class templates"
- Next in thread: SainTiss: "Re: specialization of member functions of class templates"
- Reply: SainTiss: "Re: specialization of member functions of class templates"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 25 Dec 2003 16:30:52 GMT
"SainTiss" <stiss@gmx.net> wrote...
> From what I've read in several places, it seems that explicit
specialization
> of member functions of class templates is allowed, but partial
> specialization isn't:
>
> template<class T, class R> class A {
> void foo();
> }
>
> template <>
> void A<int,double>::foo() {} // allowed
>
> template<class T>
> void A<T,double>::foo() {} // forbidden
No, not forbidden. You just have to partially specialise the class
template as well, before you attempt to define the member. 14.5.4.3/1.
> However, when looking for justification in the ISO standard (final draft,
> 1996), it seems the first isn't explicitly allowed in there, and neither
is
> the second explicitly forbidden, even though the first seems to be used in
> an example in 14.5.4.3
>
> So does anyone know what the story is then? Does the standard really
> allow/forbid this or not?
Both are allowed. A partial specialisation of a member requires
the same partial specialisation of the enclosing template to exist.
At least that's how I read the Standard.
Victor
- Next message: Rob Williscroft: "Re: probs with a simple program"
- Previous message: Rob Williscroft: "Re: static member of class"
- In reply to: SainTiss: "specialization of member functions of class templates"
- Next in thread: SainTiss: "Re: specialization of member functions of class templates"
- Reply: SainTiss: "Re: specialization of member functions of class templates"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|