Re: partial specialization

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Jack Hanebach wrote:
Victor Bazarov wrote:

template<>
struct A<double, int>
{
void foo() {}
};

and

template<>
void A<double, int>::foo() {}

(other than syntax, of course)?

The former is specialisation, the latter is a definition.

The former is specialization of A _and_ a definition of A::foo,
specializezed for double and int, the later is a definition of A::foo
specialized for double and int (and implicit specialization of A),
yes. Yet the effect of both is exactly the same...

No, it's not. It depends on the contents of struct A<T,U> definition,
which is _changed_ in the former case to a new definition and _used_
(with all relevant parts) to instantiate A<double,int> in the latter
case.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


.



Relevant Pages

  • Re: Implementing a templated "round" function?
    ... > int iround{ ... Why do you think the 1st version is integer calculation and is fast? ... At this time my function accepts only double precision floating ... > I could add a specialisation for every combination of S and T, ...
    (comp.lang.cpp)
  • Re: partial specialization
    ... (other than syntax, of course)? ... The former is specialisation, ... specializezed for double and int, the later is a definition of A::foo ...
    (microsoft.public.vc.language)
  • Re: Linux 2.6.27.8
    ... struct pt_regs *regs); ... static int printbinary ... void show_regs ...
    (Linux-Kernel)
  • [PATCH 4/7] lguest documentation:Chapter IV
    ... static int waker_fd; ... struct device *dev; ... static void *map_zeroed_pages ... * the Guest memory. ...
    (Linux-Kernel)
  • [PATCH 4/7] lguest: documentation pt IV: Launcher
    ... static int waker_fd; ... struct device *dev; ... static void *map_zeroed_pages ... * the Guest memory. ...
    (Linux-Kernel)