19 #ifndef LIB_CS_UNIQUE_ARRAY_POINTER_H
20 #define LIB_CS_UNIQUE_ARRAY_POINTER_H
22 #include <cs_pointer_traits.h>
23 #include <cs_unique_pointer.h>
29 template <
typename T,
typename Deleter = std::default_delete<cs_add_missing_extent_t<T>>>
33 using pointer =
typename std::unique_ptr<cs_add_missing_extent_t<T>, Deleter>
::pointer;
34 using element_type =
typename std::unique_ptr<cs_add_missing_extent_t<T>, Deleter>::element_type;
38 using ElementType = element_type;
50 this->m_ptr = std::move(other.m_ptr);
60 this->m_ptr = std::move(other.m_ptr);
64 ElementType &operator*() const noexcept(noexcept(* std::declval<pointer>())) {
65 return this->
get()[0];
68 ElementType &
operator[](std::size_t index)
const noexcept {
69 return this->
get()[index];
73 template <
typename T,
typename =
typename std::enable_if_t<std::is_array_v<T>>>
76 return std::make_unique<T>(size);
CsUniqueArrayPointer< T > make_unique(std::size_t size)
Definition: cs_unique_array_pointer.h:74
ElementType & operator[](std::size_t index) const noexcept
Definition: cs_unique_array_pointer.h:68
CsUniqueArrayPointer & operator=(CsUniqueArrayPointer< ElementType[]> &&other) noexcept
Definition: cs_unique_array_pointer.h:59
CsUniqueArrayPointer(CsUniqueArrayPointer< ElementType[]> &&other) noexcept
Definition: cs_unique_array_pointer.h:54
CsUniqueArrayPointer & operator=(CsUniqueArrayPointer< ElementType > &&other) noexcept
Definition: cs_unique_array_pointer.h:48
CsUniqueArrayPointer(CsUniqueArrayPointer< ElementType > &&other) noexcept
Definition: cs_unique_array_pointer.h:43
CsUniquePointer(Pointer p=nullptr) noexcept
Definition: cs_unique_pointer.h:43
typename cs_add_missing_extent< T >::type cs_add_missing_extent_t
Definition: cs_pointer_traits.h:35
deleter_type DeleterType
Definition: cs_unique_pointer.h:37
pointer Pointer
Definition: cs_unique_pointer.h:35
Pointer get() const noexcept
Definition: cs_unique_pointer.h:91
typename std::unique_ptr< cs_add_missing_extent_t< T >, Deleter >::deleter_type deleter_type
Definition: cs_unique_pointer.h:33
Contains a pointer to an object and takes exclusive ownership.
Definition: cs_shared_pointer.h:28
typename std::unique_ptr< cs_add_missing_extent_t< T >, Deleter >::pointer pointer
Definition: cs_unique_pointer.h:31
Contains a pointer to a dynamically allocated array.
Definition: cs_unique_array_pointer.h:30
Namespace for the CsPointer library.