Boost logo

Boost :

From: Daniel Wallin (daniel_at_[hidden])
Date: 2008-05-27 15:31:55


Brook Milligan wrote:
> I am trying to use Boost.Parameter to construct some objects, much
> like make_tuple(A,B) does except with some of the arguments being
> optional and replaced by defaults (which may depend on the other
> arguments). The return type, however, must be a template class with
> the template arguments dependent on the arguments supplied.
>
> Is this possible?

Yes, this is possible. The argument pack is available to the return type
computation as `Args`. Something like this should work:

   BOOST_PARAMETER_FUNCTION(
       (typename boost::parameter::value_type<Args, tag::x>::type),
       foo,
       ...
   )

This only work on trunk unfortunately and since it's not very well
covered in the test suite there might be problems with it.

HTH,

-- 
Daniel Wallin
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