QSharedPointer: add reset() member functions
These have been added for std::shared_ptr compatibility, but in particular to allow tst_qnetworkreply && friends to drop the implicit conversions added to QSP by inheritance, so QSP can become final. Change-Id: I0f0401b02125d65622e52393b40a3b10bd9a850c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
0731c90eec
commit
0ebca8f46f
@ -697,6 +697,35 @@
|
||||
the pointer itself will be deleted.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QSharedPointer::reset()
|
||||
\since 5.0
|
||||
|
||||
Same as clear(). For std::shared_ptr compatibility.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QSharedPointer::reset(T *t)
|
||||
\since 5.0
|
||||
|
||||
Resets this QSharedPointer object to point to \a t
|
||||
instead. Equivalent to:
|
||||
\code
|
||||
QSharedPointer<T> other(t); this->swap(other);
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QSharedPointer::reset(T *t, Deleter deleter)
|
||||
\since 5.0
|
||||
|
||||
Resets this QSharedPointer object to point to \a t
|
||||
instead, with deleter \a deleter. Equivalent to:
|
||||
\code
|
||||
QSharedPointer<T> other(t, deleter); this->swap(other);
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QWeakPointer::QWeakPointer()
|
||||
|
||||
|
@ -85,6 +85,11 @@ public:
|
||||
|
||||
void clear();
|
||||
|
||||
void reset();
|
||||
void reset(T *t);
|
||||
template <typename Deleter>
|
||||
void reset(T *t, Deleter deleter);
|
||||
|
||||
// casts:
|
||||
template <class X> QSharedPointer<X> staticCast() const;
|
||||
template <class X> QSharedPointer<X> dynamicCast() const;
|
||||
|
@ -510,6 +510,13 @@ public:
|
||||
inline void swap(QSharedPointer &other)
|
||||
{ QSharedPointer<T>::internalSwap(other); }
|
||||
|
||||
inline void reset() { clear(); }
|
||||
inline void reset(T *t)
|
||||
{ QSharedPointer copy(t); swap(copy); }
|
||||
template <typename Deleter>
|
||||
inline void reset(T *t, Deleter deleter)
|
||||
{ QSharedPointer copy(t, deleter); swap(copy); }
|
||||
|
||||
template <class X>
|
||||
QSharedPointer<X> staticCast() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user