
Generic programming is fairly well understood. Concepts define requirements, types model concepts, generic code manipulates models via valid expressions for that concept, etc. Also pretty well understood is how to define customization points so that arbitrary types can be made to model a concept non-intrusively. But these techniques seem to break down for object construction. Consider: template< class Inner > struct facade { facade( /* what here? */ ) : inner_( /* and what here? */ ) {} private: Inner inner_; }; How does facade know how to initialize inner_? The answer affects how facade itself should be initialized. 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? 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? -- Eric Niebler Boost Consulting www.boost-consulting.com