|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2000-11-01 14:06:02
From: "Howard Hinnant" <hinnant_at_[hidden]>
> The language people just like to irritate us mortals. Did I mention
that
> templates were added into the language on April 1? ;-)
>
> template<class T> class f{}; // #1
> template<> class f<int *> {}; // #2
> template<class T> class f<T *> {}; // #3
>
> #1 and #3 are overloads. #2 is a specialization of either #1 or #3
> depending upon order, or who you talk to. Overloads are chosen
> irrespective of specializations, then once an overload is chosen,
> specializations of that particular overload are considered... Or
> something like that. I'm just parroting what I've heard and may have
> goofed it up in the translation.
This is true for function templates (except the "who you talk to" part.)
For the example above, #2 and #3 are specializations. Classes don't
overload, unfortunately. :-)
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk