From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 2000-01-19 08:37:20
Dave Abrahams wrote:
> Valentin wrote:
> >> 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.
> Of course. I must have been temporarily insane. Why there is no function
> partial specialization is a mystery to me, but that's beside the point.
Why explicit specialisation and partial specialisation are
distinct concepts, treated differently, described in different
sections, with slightly different rules, applying to different
things, is beyond me.
I would have naturally defined complete specialisation as
a partial specialisation with no free variable.
> I disagree that option 2 is unusable for generic code, but it makes for an
> even greater amount of labor: to write generic code using it, you simply
> have to avoid using free functions at all. Instead of
> std::swap(a, b)
> you must write:
> std::swapper<A>()(a, b)
I though of that too, but quickly forgot it.
> I think function partial specialization for templates can be roughly
> approximated with the B&N trick,
You mean friend function definitions inside template classes ?
I think that it's a very powerfull trick.
> > I understand that deserving a name in all namespaces isn't
> > pleasant.
> I think you meant "reserving".
I guess that I meant that.
-- Valentin Bonnard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk