CopperSpice API  1.9.2
QScopedArrayPointer< T, Deleter > Class Template Reference

Contains a pointer to a dynamically allocated array. More...

Inheritance diagram for QScopedArrayPointer< T, Deleter >:
QUniqueArrayPointer< T, Deleter > QScopedPointer< T, Deleter >

Public Methods

 QScopedArrayPointer (QScopedArrayPointer< element_type > &&other) noexcept
 
 QScopedArrayPointer (QScopedArrayPointer< element_type[]> &&other) noexcept
 
QScopedArrayPointer & operator= (QScopedArrayPointer< element_type > &&other) noexcept
 
QScopedArrayPointer & operator= (QScopedArrayPointer< element_type[]> &&other) noexcept
 
T & operator[] (std::size_t index) const noexcept
 
- Public Methods inherited from QScopedPointer< T, Deleter >
 QScopedPointer (Pointer p, Deleter d) noexcept
 
 QScopedPointer (Pointer p=nullptr) noexcept
 
 QScopedPointer (QScopedPointer< T, Deleter > &&other)
 
 QScopedPointer (std::unique_ptr< T, Deleter > &&p) noexcept
 
 ~QScopedPointer ()
 
Pointer data () const noexcept
 
Pointer get () const noexcept
 
const Deleter & get_deleter () const noexcept
 
Deleter & get_deleter () noexcept
 
bool isNull () const noexcept
 
 operator bool () const noexcept
 
bool operator! () const noexcept
 
ElementTypeoperator* () const noexcept
 
Pointer operator-> () const noexcept
 
QScopedPointeroperator= (QScopedPointer< T, Deleter > &&other)
 
Pointer release () noexcept
 
void reset (Pointer other=nullptr)
 
void swap (QScopedPointer< T, Deleter > &other) noexcept
 
Pointer take () noexcept
 

Related Functions

These are not member functions

QScopedArrayPointer< T > QMakeScoped (std::size_t size)
 
QScopedArrayPointer< T > QMakeUnique (std::size_t size)
 

Additional Inherited Members

- Public Typedefs inherited from QScopedPointer< T, Deleter >
using deleter_type = typename std::unique_ptr< T, Deleter >::deleter_type
 
using DeleterType = deleter_type
 
using element_type = typename std::unique_ptr< T, Deleter >::element_type
 
using ElementType = element_type
 
using pointer = typename std::unique_ptr< T, Deleter >::pointer
 
using Pointer = pointer
 

Detailed Description

template<typename T, typename Deleter = std::default_delete<T>>
class QScopedArrayPointer< T, Deleter >

The QScopedArrayPointer class contains a pointer to a dynamically allocated array of objects. This class inherits from QScopedPointer and implements the operator[] method which returns a specific element in the array. When this class is destroyed the array it points to is also destroyed.

Additional Documentation

Refer to the QScopedPointer documentation for inherited methods like get(), isNull, and release().

Example

void someFunction()
{
data[2] = 42;
return;
}

Constructor & Destructor Documentation

template<typename T , typename Deleter = std::default_delete<T>>
QScopedArrayPointer< T, Deleter >::QScopedArrayPointer ( QScopedArrayPointer< element_type > &&  other)
noexcept

Move constructs a new QScopedArrayPointer from other.

template<typename T , typename Deleter = std::default_delete<T>>
QScopedArrayPointer< T, Deleter >::QScopedArrayPointer ( QScopedArrayPointer< element_type[]> &&  other)
noexcept

Move constructs a new QScopedArrayPointer from other.

Method Documentation

template<typename T , typename Deleter = std::default_delete<T>>
QScopedArrayPointer & QScopedArrayPointer< T, Deleter >::operator= ( QScopedArrayPointer< element_type > &&  other)
noexcept

Move assigns from other and returns a reference to this object.

template<typename T , typename Deleter = std::default_delete<T>>
QScopedArrayPointer & QScopedArrayPointer< T, Deleter >::operator= ( QScopedArrayPointer< element_type[]> &&  other)
noexcept

Move assigns from other and returns a reference to this object.

template<typename T , typename Deleter = std::default_delete<T>>
T & QScopedArrayPointer< T, Deleter >::operator[] ( std::size_t  index) const
noexcept

Returns a reference to the element located at the given index of the array. If this smart pointer is a nullptr then the behavior is undefined.

Friends And Related Function Documentation

QScopedArrayPointer< T > QMakeScoped ( std::size_t  size)
related

Constructs a new array containing elements of type T. The number of elements in the array will be equal to the value for size. Each element will be value initialized.

Refer to default constructed elements for additional information.

QScopedArrayPointer< T > QMakeUnique ( std::size_t  size)
related

Equivalent to calling QMakeScoped().