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

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

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

Public Typedefs

using deleter_type = typename std::unique_ptr< cs_add_missing_extent_t< T >, Deleter >::deleter_type
 
using DeleterType = deleter_type
 
using element_type = typename std::unique_ptr< cs_add_missing_extent_t< T >, Deleter >::element_type
 
using ElementType = element_type
 
using pointer = typename std::unique_ptr< cs_add_missing_extent_t< T >, Deleter >::pointer
 
using Pointer = pointer
 
- 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
 

Public Methods

 QScopedArrayPointer (QScopedArrayPointer< element_type > &&other) noexcept
 
 QScopedArrayPointer (QScopedArrayPointer< element_type[]> &&other) noexcept
 
 ~QScopedArrayPointer ()
 
bool isNull () const noexcept
 
QScopedArrayPointer & operator= (QScopedArrayPointer< element_type > &&other) noexcept
 
QScopedArrayPointer & operator= (QScopedArrayPointer< element_type[]> &&other) noexcept
 
T & operator[] (std::size_t index) const noexcept
 
void swap (QScopedArrayPointer< T, Deleter > &other) 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
 
bool operator!= (const QScopedPointer< T, Deleter > &other) const
 
bool operator!= (const T *ptr) const
 
bool operator!= (std::nullptr_t) const
 
ElementTypeoperator* () const noexcept
 
Pointer operator-> () const noexcept
 
bool operator< (const QScopedPointer< T, Deleter > &other) const
 
bool operator< (const T *ptr) const
 
bool operator< (std::nullptr_t) const
 
bool operator<= (const QScopedPointer< T, Deleter > &other) const
 
bool operator<= (const T *ptr) const
 
bool operator<= (std::nullptr_t) const
 
QScopedPointeroperator= (QScopedPointer< T, Deleter > &&other)
 
bool operator== (const QScopedPointer< T, Deleter > &other) const
 
bool operator== (const T *ptr) const
 
bool operator== (std::nullptr_t) const
 
bool operator> (const QScopedPointer< T, Deleter > &other) const
 
bool operator> (const T *ptr) const
 
bool operator> (std::nullptr_t) const
 
bool operator>= (const QScopedPointer< T, Deleter > &other) const
 
bool operator>= (const T *ptr) const
 
bool operator>= (std::nullptr_t) const
 
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

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

Detailed Description

template<typename T, typename Deleter = std::default_delete<cs_add_missing_extent_t<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(), release(), reset(), and take().

Example

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

Member Typedef Documentation

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

Typedef for std::unique_ptr< cs_add_missing_extent_t<T>, Deleter>::deleter_type.

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

Typedef for deleter_type.

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

Typedef for std::unique_ptr< cs_add_missing_extent_t<T>, Deleter>::element_type.

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

Typedef for element_type.

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

Typedef for std::unique_ptr< cs_add_missing_extent_t<T>, Deleter>::pointer.

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

Typedef for pointer.

Constructor & Destructor Documentation

template<typename T , typename Deleter = std::default_delete<cs_add_missing_extent_t<T>>>
QScopedArrayPointer< T, Deleter >::~QScopedArrayPointer ( )

Destroys this QScopedArrayPointer object.

template<typename T , typename Deleter = std::default_delete<cs_add_missing_extent_t<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<cs_add_missing_extent_t<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<cs_add_missing_extent_t<T>>>
bool QScopedArrayPointer< T, Deleter >::isNull ( ) const
noexcept

Returns true if this QScopedArrayPointer contains a nullptr, otherwise returns false.

template<typename T , typename Deleter = std::default_delete<cs_add_missing_extent_t<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<cs_add_missing_extent_t<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<cs_add_missing_extent_t<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.

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

Swap the current pointer with other.

Friends And Related Function Documentation

cs_add_missing_extent_t ( )
related

Adds array brackets to T if it does not contain them. Implemented as a templated type trait.

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.