diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2024-05-21 07:34:21 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2024-05-23 16:18:35 +0200 |
| commit | 462c958a924fe345159a95abfd32a82cd4b14c5f (patch) | |
| tree | 46f16b81761e3a22c37a9b9b6d74196de589a26d /src/sql/models/qsqlquerymodel.cpp | |
| parent | 71bc951870906abbe656d9c2f08c42c3bf35c554 (diff) | |
QSpan: add as_(writable_)bytes
For std::span, these are free functions in namespace std and therefore
work for anything implicitly convertible to std::span,
incl. QSpan. But they're C++20, QSpan needs something for C++17
builds.
By adding them as hidden friends for QSpan, we allow unqualifid calls
to transparently resolve to the respective overload, ensuring
source-compatibility between std:: and QSpan, and, eventually, a
transition back to std::as_*_bytes.
I considered the alternative to add these functions in the q20
namespace, but q20::as_bytes() would have to take QSpan, and QSpan is
convertible from more types than std::span, so we wouldn't be able to
guarantee that std::as_bytes(t) works for all T t for which
q20::as_bytes(t) works, the fundamental guarantee for namespace qNN.
[ChangeLog][QtCore][QSpan] Added std::span-style as_bytes() and
as_writable_bytes() functions.
Fixes: QTBUG-125489
Change-Id: Ia9a7560c7843e182892608178433be7349c825ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/sql/models/qsqlquerymodel.cpp')
0 files changed, 0 insertions, 0 deletions
