Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-09-25 23:43:30


"Eric Niebler" <eric_at_[hidden]> writes:

> One possibility is that facade defines N constructors that take up to N
> arguments, and just forwards them to inner_. That might work in this
> narrow case, but what if facade has 2 inner objects of different types?
> How should constructor arguments get dispatched to the different
> sub-objects? In general, facade has no way of knowing. Is this a problem
> others have run into? What sorts of techniques are people using?

Czarnecki and Eisenecker (I think) pioneered the use of tuples for
this purpose.

> I have come up with a little generic object construction utility using
> Boost.Parameter that works for me. It allows you to non-intrusively
> associate named parameters with a type for the purpose of construction,
> and a way to forward a (possibly filtered) argument pack on to
> sub-objects. Is there general interest in such a utility?

Neat idea; it's nice to have the by-name interface here.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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