diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-04-21 02:09:27 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-06-17 17:56:48 +0200 |
commit | a97cda8b8b5806d3fd170c6ffd56094bbd60bd65 (patch) | |
tree | e178ca70b611debee09588236f2efc2430acc2aa /cmake | |
parent | d2a04cf165c455f70bf8588cf75709831d1c078d (diff) |
QMath: make the math-related functions templates
This way we can take and return more datatypes than qreal,
just piggy-backing on the std:: functions (which take any
integral and any fp datatype).
This makes these functions pure ADL enablers (like qSwap).
A type (hi, QAngle!) that wants to have math related functions
simply needs those defined in its own namespace using the
"standard" names (sin, cos, etc.); and we'll find them
using the q-prefixed function.
qCeil and qFloor signatures however still return int
to avoid too much breakage.
The FP-related functions (qIsInf, etc.) have been left
alone. Those are "special"; a lot of care is in qnumeric
because some implementations define them as macros, which
blocks any possibility of user-defined overloads found via
ADL.
[ChangeLog][QtCore][QtMath] The math-related functions
(such as qSin, qCos, qPow and so on) can now take an
arbitrary parameter rather than just qreal. They will do
a ADL-enabled call to the respective free function, using
the functions in namespace std as a fallback. Moreover,
they will now return whatever datatype is returned by the
free function (e.g. long double if the call is placed on
a long double).
Change-Id: I111084eda52556663802e65a85e082187c2a6861
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'cmake')
0 files changed, 0 insertions, 0 deletions