Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 2000-01-18 14:01:35


Darin Adler wrote:

> I now understand that the standard allows specializing a function template
> but not partially specializing a function template.

Correct

> I'm not sure what partially specializing a function template would mean.

???

(Partially specializing a function template means partially specializing
a function template.)

> For
> example, take my original example from my comp.std.c++ posting. Make class U
> be a class template instead:
>
> // header file
>
> #include <algorithm>
>
> namespace N {
>
> template<typename T>
> class U
> {
> public:
> // ...
> void swap(U&);
> U& operator=(const U&);
> // ...
> };
>
> }
>
> namespace std {
>
> template<typename T>
> inline void swap(N::U<T>& one, N::U<T>& other)
> {
> one.swap(other);
> }
>
> }

> Is the std::swap specialization now a partial specialization?

As written it's a overload.

Had you wrote:

template<typename T>
void std::swap<N::U<T> > (N::U<T>& one, N::U<T>& other)
{...}

It could only have been a partial specialisation (if that
kind of things existed).

[ I don't understand where partial/explicit specialisation
  notions are from and how they are intended to work. Is it
  possible to rewrite the whole thing (all the sections
  dealing with specialisation) with a DR ? ]

-- 
Valentin Bonnard

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk