From 7ee9551b62b050f7e9aefdc19e19bac5ba263507 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 23 May 2012 21:10:31 +0200 Subject: Add support for multiple arguments to QSharedPointer::create() Requires C++11 rvalue references and variadic templates so we can implement perfect forwarding. Change-Id: I62e47d1ffd0c61e8386f9f246aa79031b7430b46 Reviewed-by: Olivier Goffart --- src/corelib/tools/qsharedpointer.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/corelib/tools/qsharedpointer.cpp') diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 167771027e..c9456c44c2 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -604,6 +604,37 @@ \sa qSharedPointerObjectCast() */ +/*! + \fn QSharedPointer QSharedPointer::create() + \since 4.6 + + Creates a QSharedPointer object and allocates a new item of type \tt T. The + QSharedPointer internals and the object are allocated in one single memory + allocation, which could help reduce memory fragmentation in a long-running + application. + + This function calls the default constructor for type \tt T. +*/ + +/*! + \fn QSharedPointer QSharedPointer::create(...) + \overload + \since 5.1 + + Creates a QSharedPointer object and allocates a new item of type \tt T. The + QSharedPointer internals and the object are allocated in one single memory + allocation, which could help reduce memory fragmentation in a long-running + application. + + This function will attempt to call a constructor for type \tt T that can + accept all the arguments passed. Arguments will be perfectly-forwarded. + + \note This function is only available with a C++11 compiler that supports + perfect forwarding of an arbitrary number of arguments. If the compiler + does not support the necessary C++11 features, you must use the overload + that calls the default constructor. +*/ + /*! \fn QWeakPointer QSharedPointer::toWeakRef() const -- cgit v1.2.3