Make the fetchAndAddRelaxed function a member template

This way, no compiler can instantiate it at class instantiation time. We
don't want them to do it for T that are function pointers (sizeof
functions is meaningless).

Change-Id: I6d5044bd5d9ffd0d347f1f38ab33c64213730788
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Thiago Macieira 2014-06-23 11:47:49 -07:00 committed by David Faure
parent 0e14a58a96
commit 00dce1cc00

View File

@ -85,8 +85,8 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> >
return tmp;
}
static
T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
template <typename AdditiveType> static
T fetchAndAddRelaxed(T &_q_value, AdditiveType valueToAdd) Q_DECL_NOTHROW
{
T returnValue = _q_value;
_q_value += valueToAdd;