
On Fri, Oct 5, 2012 at 11:36 AM, Matt Calabrese <rivorus@gmail.com> wrote:
On Fri, Oct 5, 2012 at 2:08 PM, Lorenzo Caminiti <lorcaminiti@gmail.com>wrote:
Hello all,
One a separate note, why the following SFINAE impl of EqualityComparable returns 0 on std::common_type<int, int>::type?
EqualityComparable<int>::value // 1 -- ok EqualityComparable<std::common_type<int>::type>::value // 1 -- ok
EqualityComparable<std::common_type<int, int>::type>::value // 0 -- why??
common_type< int, int >::type would be int&&. In your EqualityComparable implementation, your function parameter types are the argument of EqualityComparable directly, which is an r-value reference type. In your explicit call to check<_1>, you are passing "a" and "b" directly, but the parameter types of check expect r-value references. In order for this to work, you'd need to use std::forward.
I see, thanks! --Lorenzo