Boost logo

Boost :

From: Cédric Venet (cedric.venet_at_[hidden])
Date: 2007-07-10 10:00:32


Quoting Andrew Sutton <asutton_at_[hidden]>:

>
> On Jul 10, 2007, at 9:02 AM, Cédric Venet wrote:
>> boost.optional should serve your purpose.
>
> I had previously considered that as an option (no pun).
> Unfortunately, I don't think this helps if I choose to adopt a
> compile-time function selection. Otherwise, it would work very nicely
> at runtime. I've still got it on my short list of solutions.
>

first, doing compile time dipatching is only usefull if your function
is very short and the additionnal function call time is relevant (I
don't think it is the case for you).

If you really want a compile time dispatch, you can try to use mpl in
order to find out if the parameter is in the ArgumentPack and dispatch
on the result. from the doc:

"""
An ArgumentPack is a collection of tagged references to the actual
arguments passed to a function. Every ArgumentPack is also a valid MPL
Forward Sequence consisting of the keyword tag types in its tagged
references.
"""

so it shouldn't be to hard to do. But you trade compile time versus
runtime (and the runtime loss of dynamique dispatch is pretty low).

for your other question:

"""
7 Configuration Macros
7.1 BOOST_PARAMETER_MAX_ARITY
Determines the maximum number of arguments supported by the library.
Will only be #defined by the library if it is not already #defined.
Defined in: boost/parameter/config.hpp
Default Value: 5
"""

so you can easily augment this (at the cost of some compile time probably)

doc link => http://www.boost.org/libs/parameter/doc/html/reference.html


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