QtBase  v6.3.1
Public Member Functions | List of all members
QScopedArrayPointer< T, Cleanup > Class Template Reference

The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects, and deletes it upon destruction. More...

#include <qscopedpointer.h>

Inheritance diagram for QScopedArrayPointer< T, Cleanup >:
Inheritance graph
[legend]
Collaboration diagram for QScopedArrayPointer< T, Cleanup >:
Collaboration graph
[legend]

Public Member Functions

 QScopedArrayPointer ()
 
 ~QScopedArrayPointer ()=default
 
template<typename D , if_same_type< D > = true>
 QScopedArrayPointer (D *p)
 
Toperator[] (int i)
 
const Toperator[] (int i) const
 
- Public Member Functions inherited from QScopedPointer< T, QScopedPointerArrayDeleter< T > >
 QScopedPointer (T *p=nullptr) noexcept
 
 ~QScopedPointer ()
 
Toperator* () const
 
Toperator-> () const noexcept
 
bool operator! () const noexcept
 
 operator bool () const
 
Tdata () const noexcept
 
Tget () const noexcept
 
bool isNull () const noexcept
 
void reset (T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
 

Additional Inherited Members

- Public Types inherited from QScopedPointer< T, QScopedPointerArrayDeleter< T > >
typedef Tpointer
 
- Protected Attributes inherited from QScopedPointer< T, QScopedPointerArrayDeleter< T > >
Td
 

Detailed Description

template<typename T, typename Cleanup = QScopedPointerArrayDeleter<T>>
class QScopedArrayPointer< T, Cleanup >

The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects, and deletes it upon destruction.

\inmodule QtCore

Since
4.6 \reentrant

A QScopedArrayPointer is a QScopedPointer that defaults to deleting the object it is pointing to with the delete[] operator. It also features operator[] for convenience, so we can write:

void foo()
{
i[2] = 42;
...
return; // our integer array is now deleted using delete[]
}
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects,...
QString foo
[0]

Definition at line 226 of file qscopedpointer.h.

Constructor & Destructor Documentation

◆ QScopedArrayPointer() [1/2]

template<typename T , typename Cleanup = QScopedPointerArrayDeleter<T>>
template< typename T, typename Cleanup > QScopedArrayPointer< T, Cleanup >::QScopedArrayPointer ( )
inline

Constructs a QScopedArrayPointer instance.

Definition at line 231 of file qscopedpointer.h.

◆ ~QScopedArrayPointer()

template<typename T , typename Cleanup = QScopedPointerArrayDeleter<T>>
QScopedArrayPointer< T, Cleanup >::~QScopedArrayPointer ( )
inlinedefault

◆ QScopedArrayPointer() [2/2]

template<typename T , typename Cleanup = QScopedPointerArrayDeleter<T>>
template<typename D , if_same_type< D > = true>
template< typename T, typename Cleanup > template< typename D > QScopedArrayPointer< T, Cleanup >::QScopedArrayPointer ( D p)
inlineexplicit

Constructs a QScopedArrayPointer and stores the array of objects pointed to by p.

Definition at line 235 of file qscopedpointer.h.

Member Function Documentation

◆ operator[]() [1/2]

template<typename T , typename Cleanup = QScopedPointerArrayDeleter<T>>
template< typename T, typename Cleanup > T * QScopedArrayPointer< T, Cleanup >::operator[] ( int  i)
inline

Provides access to entry i of the scoped pointer's array of objects.

If the contained pointer is \nullptr, behavior is undefined.

See also
isNull()

Definition at line 240 of file qscopedpointer.h.

◆ operator[]() [2/2]

template<typename T , typename Cleanup = QScopedPointerArrayDeleter<T>>
template< typename T, typename Cleanup > T * QScopedArrayPointer< T, Cleanup >::operator[] ( int  i) const
inline

Provides access to entry i of the scoped pointer's array of objects.

If the contained pointer is \nullptr behavior is undefined.

See also
isNull()

Definition at line 245 of file qscopedpointer.h.


The documentation for this class was generated from the following files: