|
Boost : |
Subject: Re: [boost] [type_traits] common_type and SFINAE
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-10-04 23:56:34
On Thu, Oct 4, 2012 at 9:15 AM, Vicente J. Botet Escriba <
vicente.botet_at_[hidden]> wrote:
> Le 04/10/12 15:02, Jeffrey Lee Hellrung, Jr. a écrit :
>
>> On Thu, Oct 4, 2012 at 12:28 AM, Lorenzo Caminiti <lorcaminiti_at_[hidden]
>> >wrote:
>>
>> Hello all,
>>>
>>> common_type<T, U>::type is defined in a way that gives a hard compiler
>>> error if T and U do not have a common type (this is also how
>>> common_type is implemented in C++11).
>>>
>>> An alternative design (I'm not sure if implementable) would have been
>>> to not define the type member in case T and U have no common type.
>>> This way I could use SFINAE to detect if common_type<T, U>::type does
>>> not exist and therefore if T and U have not common type -- so to
>>> implement N3351's concept Common<T, U>.
>>>
>>> Is there a way to implement this alternative design?
>>>
>>> Do you also need this in C++03?
>>
>> Even if Lorenzo doesn't needs it, it will be great to have it in Boost.
> Jeffrey, do you have something that is working already?
>
I don't yet, but this should be fairly straightforward based on the present
C++03 implementation. I guess I can try to get this in this weekend?
- Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk