
On Thu, Oct 4, 2012 at 6:02 AM, Jeffrey Lee Hellrung, Jr. <jeffrey.hellrung@gmail.com> wrote:
On Thu, Oct 4, 2012 at 12:28 AM, Lorenzo Caminiti <lorcaminiti@gmail.com>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?
No, C++11 only and thanks a lot to Matt for the code! --Lorenzo