Boost logo

Boost :

Subject: Re: [boost] [function_types] Number of default parameters
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-02-08 20:50:21


AMDG

On 2/8/2011 5:38 PM, Lorenzo Caminiti wrote:
> Is there a way to determine at compile-time the number of parameters
> with default values from a function type?
>
> For example, can I program the following `count_defaults` metafunction?
>
> count_defaults< bool(*)(int x, int y)>::value // == 0
> count_defaults< bool(*)(int x, int y = 1>::value // == 1
> count_defaults< bool(*)(int x = 2, int y =1)>::value // == 2
>
> (If this is possible, it could be added to Boost.FunctionTypes.)
>

No. The default parameters are not part of the type.

In Christ,
Steven Watanabe


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