|
Boost : |
Subject: Re: [boost] [parameter] non-type template params
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2011-10-26 08:23:53
Dave Abrahams wrote:
>
> on Mon Oct 24 2011, lcaminiti <lorcaminiti-AT-gmail.com> wrote:
>
>> Hello all,
>>
>> Does Boost.Parameter support named parameters for non-type template
>> parameters?
>
> Not directly. You have to wrap them in types.
>
I see. For example, something like this-- correct?
namespace num {
BOOST_PARAMETER_TEMPLATE_KEYWORD(Value)
BOOST_PARAMETER_TEMPLATE_KEYWORD(DefaultValue)
CONTRACT_CLASS(
template(
in typename Value, default int,
in requires(is_same<typename _::type, Value>) DefaultValue, default
int_<0>
)
struct (integer)
) {
integer ( Value const& i = DefaultValue::value ) : i_(i) {}
private:
Value i_;
};
} // namespace num
int main ( )
{
num::integer< num::_DefaultValue< int_<10> > > i;
num::integer< > j;
num::integer< num::_DefaultValue< long_<10> >, num::_Value<long> > l;
num::integer< char, char_<'z'> > c;
return 0;
}
--Lorenzo
-- View this message in context: http://boost.2283326.n4.nabble.com/boost-parameter-non-type-template-params-tp3935131p3940421.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk