|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-04-17 09:37:02
On Wednesday 17 April 2002 10:09 am, you wrote:
> Have you thought already about adding the threading policy?
> The packed interface has the benefit that the template has exactly two
> arguments, so adding a third optional arg (a policy) is not a problem.
> I can't think of a way to add an *optional* policy class to function<>
> given its variable arguments.
>
> Fernando Cacciola
> Sierra s.r.l.
> fcacciola_at_[hidden]
> www.gosierra.com
Function already has a bunch of other template parameters (Allocator, Mixin,
and invocation Policy), so this isn't new territory. boost::function uses
named template parameters to support these extra parameters in a generative
manner:
boost::function<void, int, float, double>::threading_policy<MyPolicy>::type
Or one can just use the numbered variants. I personally use the numbered
variants instead of the generate template because it's rare for me to use a
Boost.Function object with more than 2 arguments, and I definately don't use
each of 0-10 arguments in one file :). Pulling in just
<boost/function/function2.hpp> is much faster than <boost/function.hpp>.
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk