diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-09-20 22:12:35 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-09-22 15:54:31 +0200 |
commit | aa19704bbc35d5310b33a9fbe2added77470a836 (patch) | |
tree | d6fc31a446ce0ad079c4b8f329c3ce065d777788 /src/corelib/doc | |
parent | 42d29441914da263a160d631f56c6d95f85eac70 (diff) |
Un-deprecate qSwap()
It seems to have fallen prey to the mass-deprecation of <QtAlgorithms>
in Qt 5.2. Since it didn't actually duplicate STL functionality, that
was uncalled-for: Unlike std::swap(), it's ADL-enabled, so the docs
were wrong to suggest replacing it with std::swap instead.
In fact, the tony-table that 5957f245c6c77c98d7e90d614c9fe2cdbfe7e8e6
added to qalgorithms.qdoc didn't include qSwap(), yet, qSwap() was
marked as deprecated.
Un-deprecate and expand the discussion to more faithfully represent
its value, without going into the depths of teaching how to swap
correctly in C++ (link to boost.org and cppreference.com for that
instead).
Remove the example that used qSwap() on doubles, which is precisely
_not_ how you should use it.
Amends 5957f245c6c77c98d7e90d614c9fe2cdbfe7e8e6(!).
[ChangeLog][QtCore] Un-deprecated qSwap().
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I4981005ba71b0d1824f2a46897145255fa66a7ea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Diffstat (limited to 'src/corelib/doc')
-rw-r--r-- | src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp b/src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp index 201517aa2a..f2b94a7416 100644 --- a/src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp +++ b/src/corelib/doc/snippets/code/doc_src_qalgorithms.cpp @@ -1,15 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -//! [0] -double pi = 3.14; -double e = 2.71; - -qSwap(pi, e); -// pi == 2.71, e == 3.14 -//! [0] - - //! [1] QList<Employee *> list; list.append(new Employee("Blackpool", "Stephen")); |