Subject: Re: [boost] "Simple C++11 metaprogramming"
From: Eric Niebler (eniebler_at_[hidden])
Date: 2015-06-05 11:20:34
On 6/5/2015 5:42 AM, Peter Dimov wrote:
> Eric Niebler wrote:
>>> (This implements the specification in the latest C++17 draft.)
>> I'm not so sure. If a user defines a specialization for
>> common_type<MyInt, int>, it won't get used when computing
>> common_type<MyInt, int, int>.
> As it turns out, users are not allowed to specialize common_type,
> which is why the C++17 specification does not concern itself with
> such specializations.
It's in Table 57 - Other transformations, where common_type is described:
> template <class... T> struct common_type;
> The member typedef type shall be defined as set out below. All
> types in the parameter pack T shall be complete or (possibly cv)
> void. A program may specialize this trait if at least one template
> parameter in the specialization is a user-defined type. [ Note:
> Such specializations are needed when only explicit conversions are
> desired among the template arguments. --end note ]
> As a curiosity, decaying the arguments before the conditional
> operator is also subtly wrong.
Hrm, interesting. I think there's a library issue about that.
-- Eric Niebler Boost.org http://www.boost.org
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk