Boost logo

Boost :

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


Dave Abrahams wrote:

> In generic programs, there are two ways to allow users to customize
> behaviors of called functions for their own types:
>
> 1. We can use overloading and rely on Koenig lookup to help select specific
> implementations.
> 2. We can supply a function template and rely on the user to specialize it
> for her own types.

[ very good explanation sniped ]

> I'm not absolutely sure what the policy ought to be for generic code, though
> I lean toward the high-labor, low-intrusiveness approach (option 2).

Since there is no such thing a function partial specialization,
option 2 is unusable for any kind of generic code.

I understand that deserving a name in all namespaces isn't
pleasant.

[Standard question:

Is it allowed to define a template function explicit specialization
in a friend declaration, as in the following ?

template <typename> void foo();

struct bar {
    template<> friend void foo<int> () {}
};

(g++ rejects it) --end standard question]

-- 
Valentin Bonnard

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