diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-12-01 14:43:53 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-12-01 14:53:23 +0100 |
commit | 5494f0af323a42390f9375c75e9298290ecb7662 (patch) | |
tree | b71cf16b05d891528a9d973fee07d769c9f0e108 /src/corelib/kernel/qmetatype.cpp | |
parent | c4d488eeb9f08d48eed76c941ac36b7ab05515ea (diff) |
Add a note about where to declare the streaming operators
Streaming operators for types used together with QMetaType should
get declared in the same namespace as the type itself because
of C++s ADL rules. Add a note about that to the documentation.
Pick-to: 6.0
Fixes: QTBUG-88990
Change-Id: I5d687576c6d926823dd0f1fec0743e877ae271af
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmetatype.cpp')
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 21fd2d2aed..7298dc588f 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -245,7 +245,8 @@ Q_GLOBAL_STATIC(QMetaTypeCustomRegistry, customTypeRegistry) \note This method also registers the stream and debug operators for the type if they are visible at registration time. As this is done automatically in some places, it is strongly recommended to declare the stream operators for a type directly - after the type itself. + after the type itself. Because of the argument dependent lookup rules of C++, it is + also strongly recommended to declare the operators in the same namespace as the type itself. The stream operators should have the following signatures: |