|
Boost : |
Subject: Re: [boost] [chrono] type_traits/common_type and integer/ratio
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-12-06 13:05:31
----- Original Message -----
From: "joel falcou" <joel.falcou_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, December 06, 2009 10:57 AM
Subject: Re: [boost] [chrono] type_traits/common_type and integer/ratio
>
> joel falcou wrote:
>> could be nice if they used mpl::integral_c so it can be used easily as
>> MPL meta-functions
> forgot the code obv. :
>
> namespace mpl
> {
> template<class X> struct abs : integral_c< typename X::value_type, (X
> < 0 ? -X : X)> {};
> }
>
> etc
>
> --
Hi Joel,
even if
template <boost::intmax_t X>
struct static_abs
{
static const boost::intmax_t value = X < 0 ? -X : X;
};
don't use mpl::integral_c, it is a valid mpl metafunction. I don't think it is worth adding a dependency to Boost.MPL.
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk