CsPointer  1.0.1
CsPointer::CsUniqueArrayPointer< T, Deleter > Class Template Reference

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

Inheritance diagram for CsPointer::CsUniqueArrayPointer< T, Deleter >:
CsPointer::CsUniquePointer< cs_add_missing_extent_t< T >, Deleter >

Public Member Functions

 CsUniqueArrayPointer (CsUniqueArrayPointer< ElementType > &&other) noexcept
 
CsUniqueArrayPointer & operator= (CsUniqueArrayPointer< ElementType > &&other) noexcept
 
 CsUniqueArrayPointer (CsUniqueArrayPointer< ElementType[]> &&other) noexcept
 
CsUniqueArrayPointer & operator= (CsUniqueArrayPointer< ElementType[]> &&other) noexcept
 
ElementType & operator[] (std::size_t index) const noexcept
 
- Public Member Functions inherited from CsPointer::CsUniquePointer< cs_add_missing_extent_t< T >, Deleter >
 CsUniquePointer (Pointer p=nullptr) noexcept
 
 CsUniquePointer (Pointer p, Deleter d) noexcept
 
 CsUniquePointer (std::unique_ptr< cs_add_missing_extent_t< T >, Deleter > &&p) noexcept
 
 CsUniquePointer (CsUniquePointer &&other) = default
 
Pointer data () const noexcept
 
Pointer get () const noexcept
 
Deleter & get_deleter () noexcept
 
const Deleter & get_deleter () const noexcept
 
bool is_null () const noexcept
 
 operator bool () const noexcept
 
 operator std::unique_ptr< cs_add_missing_extent_t< T >, Deleter > () &&noexcept
 
bool operator! () const noexcept
 
ElementTypeoperator* () const noexcept (noexcept (*std::declval< Pointer >()))
 
Pointer operator-> () const noexcept
 
CsUniquePointeroperator= (CsUniquePointer &&other) = default
 
Pointer release () noexcept
 
void reset (Pointer other=nullptr) noexcept
 
void swap (CsUniquePointer &other) noexcept
 
Pointer take () noexcept
 
 ~CsUniquePointer () = default
 

Related Functions

These are not member functions

CsUniqueArrayPointer< T > make_unique (std::size_t size)
 

Additional Inherited Members

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

Detailed Description

template<typename T, typename Deleter = std::default_delete<cs_add_missing_extent_t<T>>>
class CsPointer::CsUniqueArrayPointer< T, Deleter >

The CsUniqueArrayPointer class contains a pointer to a dynamically allocated array of objects. This class inherits from CsUniquePointer 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 CsUniquePointer 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<cs_add_missing_extent_t<T>>>
CsUniqueArrayPointer::CsUniqueArrayPointer ( CsUniqueArrayPointer< ElementType > &&  other)
inlinenoexcept

Move constructs a new CsUniqueArrayPointer from other.

template<typename T , typename Deleter = std::default_delete<cs_add_missing_extent_t<T>>>
CsUniqueArrayPointer::CsUniqueArrayPointer ( CsUniqueArrayPointer< ElementType[]> &&  other)
inlinenoexcept

Move constructs a new CsUniqueArrayPointer from other.

Member Function Documentation

template<typename T , typename Deleter = std::default_delete<cs_add_missing_extent_t<T>>>
CsUniqueArrayPointer & CsUniqueArrayPointer::operator= ( CsUniqueArrayPointer< ElementType > &&  other)
inlinenoexcept

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>>>
CsUniqueArrayPointer & CsUniqueArrayPointer::operator= ( CsUniqueArrayPointer< ElementType[]> &&  other)
inlinenoexcept

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 & CsUniqueArrayPointer::operator[] ( std::size_t  index) const
inlinenoexcept

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

CsUniqueArrayPointer< T > make_unique ( 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.