Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-01-19 12:22:19


"Edward Diener" <eddielee_at_[hidden]> writes:

> Maybe it should be refactored out into the MPL if it is generic enough to do
> so and then others can use it more easily in their own policy-like
> classes ?

I really think that MPL is an inappropriate place for it. It would be
very useful as a separate library, though. Boost.Python uses the
technique for template parameters and for function arguments, so we'd
want to support both.

> If it is not generic enough, maybe the technique can be documented
> somewhere. I know as a user of policy-like classes the biggest difficulty is
> having to choose the correct optional parameters when one wants to change
> any one of them from the default. If your technique can get around this
> limitation while providing multiple policies, I would love to read about how
> it works so that if I ever design policy-based template classes I can use it
> also.

It can, provided that you can write a predicate metafunction which
distinguishes each type (policy) you're interested in. When two of
the optional arguments can have identical interfaces and/or other
detectable requirements, my technique breaks down.

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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