I'm trying to eliminate an overload from an overload set if operator+=
is missing.
I know how to check if T+T
is legal :
template<typename T,
typename CheckTplusT = decltype(std::declval<T>() + std::declval<T>())>
void foo(T a, T b, ...)
{
a = a + b;
}
but this doesn't work for +=
template<typename T,
typename CheckTplusT = decltype(std::declval<T>() += std::declval<T>())>
void foo(T a, T b, ...)
{
a += b;
}
Is this fixable by using another expression inside decltype
or do I need another SFINAE construct?
The reason I need this eliminated from the overload set is that it clashes with another overload that accepts a functor to be used as an alternative to +=
. Compilers are VS2013, gcc4.8