Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2006-03-01 21:45:02


"Johan Nilsson" <r.johan.nilsson_at_[hidden]> writes:

> I've experimented some with defining a parameter::parameters specification
> and use (the undocumented) BOOST_PARAMETER_MEMFUN, but that obviously
> doesn't work (forwarding, return values and constructors don't
> mix).

Generally you have to forward the overloaded constructors to a base
class constructor that takes the ArgumentPack and does all the "real"
work. IOW, you may need to insert a base class in the hierarchy just
for the purpose of construction.

> It
> should be possible (I think) to define a BOOST_PARAMETER_CTOR macro that
> generate the ctor overloads and forwards to a setter method instead of the
> other way around.

It won't be general enough to initialize constant or reference
members.

> 2. Is there a way of detecting whether an argument was passed using position
> or name?

Nope.

> Or, even better, is there a way of restricting the arguments to
> only be passed by name using the parameters specification?

Nope. Why do you want to do that?

> 3. Not a question really, but having a default arity of 5 seems awfully low
> to me. I hit that limit on first usage, and as the named parameters are
> supposed to be used in the interface of my wrapping library, forcing users
> to define BOOST_PARAMETER_MAX_ARITY "globally" feels a bit like asking for
> someone coming up and asking me to decode some compile errors.

Reasonable point. Daniel, what do you think?

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

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net