Add qMove macro to support std::move
Change-Id: I373e07f479c11b172dab35ed7e5b62724aa50a1a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
e4505acd12
commit
958aaf3770
|
|
@ -779,4 +779,10 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
#define qMove(x) std::move(x)
|
||||
#else
|
||||
#define qMove(x) (x)
|
||||
#endif
|
||||
|
||||
#endif // QCOMPILERDETECTION_H
|
||||
|
|
|
|||
|
|
@ -3006,4 +3006,12 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
|||
{Debugging Techniques}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro qMove(x)
|
||||
\relates <QtGlobal>
|
||||
|
||||
It expands to "std::move" if your compiler supports that C++11 function, or to nothing
|
||||
otherwise.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -2556,6 +2556,9 @@ void testContainer()
|
|||
c1 = newInstance<Container>();
|
||||
QVERIFY(c1.size() == 4);
|
||||
QVERIFY(c1 == newInstance<Container>());
|
||||
Container c2 = qMove(c1);
|
||||
QVERIFY(c2.size() == 4);
|
||||
QVERIFY(c2 == newInstance<Container>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue