equal
deleted
inserted
replaced
55 QScopedPointer is a small utility class that heavily simplifies this by |
55 QScopedPointer is a small utility class that heavily simplifies this by |
56 assigning stack-based memory ownership to heap allocations, more generally |
56 assigning stack-based memory ownership to heap allocations, more generally |
57 called resource acquisition is initialization(RAII). |
57 called resource acquisition is initialization(RAII). |
58 |
58 |
59 QScopedPointer guarantees that the object pointed to will get deleted when |
59 QScopedPointer guarantees that the object pointed to will get deleted when |
60 the current scope dissapears. |
60 the current scope disappears. |
61 |
61 |
62 Consider this function which does heap allocations, and have various exit points: |
62 Consider this function which does heap allocations, and have various exit points: |
63 |
63 |
64 \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 0 |
64 \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 0 |
65 |
65 |
225 Swap this pointer with \a other. |
225 Swap this pointer with \a other. |
226 */ |
226 */ |
227 |
227 |
228 /*! |
228 /*! |
229 \class QScopedArrayPointer |
229 \class QScopedArrayPointer |
230 |
230 |
231 \brief The QScopedArrayPointer class stores a pointer to a |
231 \brief The QScopedArrayPointer class stores a pointer to a |
232 dynamically allocated array of objects, and deletes it upon |
232 dynamically allocated array of objects, and deletes it upon |
233 destruction. |
233 destruction. |
234 |
234 |
235 \since 4.6 |
235 \since 4.6 |