Smart Pointers: Difference between revisions
Jump to navigation
Jump to search
(add QScopedArrayPointer) |
(Cleanup) |
||
Line 1: | Line 1: | ||
{{ | {{LangSwitch}} | ||
[[Category:Developing_with_Qt::General]] | [[Category:Developing_with_Qt::General]] | ||
== Purpose == | == Purpose == | ||
A smart pointer is an abstract data type that has all features of a standard pointer and additionally provides automatic garbage collection. Smart pointers facilitate the dynamic memory operations. Their main advantage is reducing memory leaks and bugs due to poor memory management. | |||
== Smart Pointers in Qt == | == Smart Pointers in Qt == | ||
* | * {{DocLink|QPointer}} | ||
* | * {{DocLink|QSharedDataPointer}} | ||
* | * {{DocLink|QExplicitlySharedDataPointer}} | ||
* QtPatternist::AutoPtr (internal class) | * QtPatternist::AutoPtr (internal class) | ||
* | * {{DocLink|QSharedPointer}} | ||
* | * {{DocLink|QWeakPointer}} | ||
* QGuard (internal class) | * QGuard (internal class) | ||
* | * {{DocLink|QScopedPointer}} | ||
* | * {{DocLink|QScopedArrayPointer}} | ||
= See also = | == See also == | ||
[http://blog.qt.io/blog/2009/08/25/count-with-me-how-many-smart-pointer-classes-does-qt-have/ Count with me: how many smart pointer classes does Qt have?] | [http://blog.qt.io/blog/2009/08/25/count-with-me-how-many-smart-pointer-classes-does-qt-have/ Count with me: how many smart pointer classes does Qt have?] | ||
= References = | == References == | ||
[http://en.wikipedia.org/wiki/Smart_pointers Smart Pointer] | [http://en.wikipedia.org/wiki/Smart_pointers Smart Pointer] |
Revision as of 22:28, 27 June 2015
Purpose
A smart pointer is an abstract data type that has all features of a standard pointer and additionally provides automatic garbage collection. Smart pointers facilitate the dynamic memory operations. Their main advantage is reducing memory leaks and bugs due to poor memory management.
Smart Pointers in Qt
- QPointer
- QSharedDataPointer
- QExplicitlySharedDataPointer
- QtPatternist::AutoPtr (internal class)
- QSharedPointer
- QWeakPointer
- QGuard (internal class)
- QScopedPointer
- QScopedArrayPointer
See also
Count with me: how many smart pointer classes does Qt have?