diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-08-14 09:41:18 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-08-22 09:39:07 +0000 |
commit | d1b099c3e3cfcbf86353b53e205c0ebf84cf5592 (patch) | |
tree | 3cb4d80328fad7b7a6034616f563555627954929 /dist/changes-4.0.1 | |
parent | 5b2dfbc649a7c20a93223cd4c274a4b0fe847df8 (diff) |
QBezier: replace out parameters by return-by-value in split()
At least QBezier itself is calling the old function with *this aliased
to one of the arguments. Consequently, the implementation looks rather
... shuffled, to avoid writing into members that it will read once
more later.
Fix by returning a std::pair<QBezier, QBezier> instead. This
simplifies the code that doesn't actually pass existing objects in,
and avoids aliasing problems cropping up under seemingly innocuous
reorderings of statements in the implementation going forward.
While I'm usually vehemently against use std::pair or std::tuple in
APIs, preferring simple structs with aptly-named members instead, this
is one case where the .first and .second actually fit, and pair allows
us to use std::tie, which was handy in qbezier.cpp.
This patch preserves the body of the function as much as possible. A
follow-up patch will clean it up.
Change-Id: I017dfee4a0e69a2e171ce21b89ba04654772c33d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'dist/changes-4.0.1')
0 files changed, 0 insertions, 0 deletions