diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-03-09 13:54:56 +0100 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-04-07 17:41:06 +0000 |
commit | 795a54ff9688697c033fc5d522f4c50c707d5924 (patch) | |
tree | 20468045310d1cc5e65a1faeb2508c96f41eff33 /src/corelib/io/qdatastream.h | |
parent | 25d1bbb84939b6960f16e82254fc844839ddfa54 (diff) |
QDataStream: add operator<< and >> for std::nullptr_t
std::nullptr_t is nullary: it accepts only one value, nullptr. So we
don't need to read or write anything. This commit simply adds the two
operators that allow generic code to operate on std::nullptr_t if
required.
This commit also adds the actual use to QMetaType::load/save, even
though there's no change in behavior.
[ChangeLog][QtCore][QDataStream] Added operator<< and operator>>
overloads that take std::nullptr_t, to facilitate generic code.
Change-Id: Iae839f6a131a4f0784bffffd14aa37e7f62d2740
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/io/qdatastream.h')
-rw-r--r-- | src/corelib/io/qdatastream.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index db1bbfbd63..575607e147 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -152,6 +152,7 @@ public: QDataStream &operator>>(quint32 &i); QDataStream &operator>>(qint64 &i); QDataStream &operator>>(quint64 &i); + QDataStream &operator>>(std::nullptr_t &ptr) { ptr = nullptr; return *this; } QDataStream &operator>>(bool &i); QDataStream &operator>>(qfloat16 &f); @@ -167,6 +168,7 @@ public: QDataStream &operator<<(quint32 i); QDataStream &operator<<(qint64 i); QDataStream &operator<<(quint64 i); + QDataStream &operator<<(std::nullptr_t) { return *this; } QDataStream &operator<<(bool i); QDataStream &operator<<(qfloat16 f); QDataStream &operator<<(float f); |