Documention: Use const-ref in the snippets for qOverload()

This makes it clearer that const-ref needs to be specified in
the template arguments of qOverload() and related.

Change-Id: I527c8ca853be159af8665e9759d9549df10573b3
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Friedemann Kleint 2018-11-27 13:59:53 +01:00
parent 1b5bbacdb0
commit d41879db38

View File

@ -647,24 +647,24 @@ template<> class QTypeInfo<A> : public QTypeInfoMerger<A, B, C, D> {};
//! [52]
struct Foo {
void overloadedFunction();
void overloadedFunction(int, QString);
void overloadedFunction(int, const QString &);
};
... qOverload<>(&Foo::overloadedFunction)
... qOverload<int, QString>(&Foo::overloadedFunction)
... qOverload<int, const QString &>(&Foo::overloadedFunction)
//! [52]
//! [53]
... QOverload<>::of(&Foo::overloadedFunction)
... QOverload<int, QString>::of(&Foo::overloadedFunction)
... QOverload<int, const QString &>::of(&Foo::overloadedFunction)
//! [53]
//! [54]
struct Foo {
void overloadedFunction(int, QString);
void overloadedFunction(int, QString) const;
void overloadedFunction(int, const QString &);
void overloadedFunction(int, const QString &) const;
};
... qConstOverload<int, QString>(&Foo::overloadedFunction)
... qNonConstOverload<int, QString>(&Foo::overloadedFunction)
... qConstOverload<int, const QString &>(&Foo::overloadedFunction)
... qNonConstOverload<int, const QString &>(&Foo::overloadedFunction)
//! [54]
//! [qlikely]