Audacity 3.2.0
Public Types | Public Member Functions | Private Attributes | List of all members
PackedArray::Deleter< Type, BaseDeleter > Struct Template Reference

Deleter for an array of elements and optional contiguous header structure. More...

#include <PackedArray.h>

Inheritance diagram for PackedArray::Deleter< Type, BaseDeleter >:
[legend]
Collaboration diagram for PackedArray::Deleter< Type, BaseDeleter >:
[legend]

Public Types

using managed_type = Type
 
using base_type = BaseDeleter< managed_type >
 
using traits_type = detail::ExtendedTraits< managed_type >
 
using header_type = typename traits_type::header_type
 
using element_type = typename traits_type::element_type
 

Public Member Functions

 Deleter (size_t size=0) noexcept
 
void operator() (Type *p) const noexcept(noexcept((void) std::declval< element_type >().~element_type(),(void) std::declval< header_type >().~header_type(),(void) std::declval< base_type >()(p)))
 
size_t GetCount () const
 

Private Attributes

size_t mCount = 0
 

Detailed Description

template<typename Type, template< typename > typename BaseDeleter = std::default_delete>
struct PackedArray::Deleter< Type, BaseDeleter >

Deleter for an array of elements and optional contiguous header structure.

Template Parameters
Typeis the type pointed to, and an explicit specialization of Traits<Type> may redefine the nested types for a non-empty header:
  • header_type, which overlays the members of Type except the last member; may be non-empty and define a destructor
  • element_type must be such that the last member of Type is Element[1]; may define a destructor And Traits<Type> may also define a pointer-to-data-member of T called array_member
BaseDeletermanages the main deallocation

Definition at line 87 of file PackedArray.h.

Member Typedef Documentation

◆ base_type

template<typename Type , template< typename > typename BaseDeleter = std::default_delete>
using PackedArray::Deleter< Type, BaseDeleter >::base_type = BaseDeleter<managed_type>

Definition at line 89 of file PackedArray.h.

◆ element_type

template<typename Type , template< typename > typename BaseDeleter = std::default_delete>
using PackedArray::Deleter< Type, BaseDeleter >::element_type = typename traits_type::element_type

Definition at line 92 of file PackedArray.h.

◆ header_type

template<typename Type , template< typename > typename BaseDeleter = std::default_delete>
using PackedArray::Deleter< Type, BaseDeleter >::header_type = typename traits_type::header_type

Definition at line 91 of file PackedArray.h.

◆ managed_type

template<typename Type , template< typename > typename BaseDeleter = std::default_delete>
using PackedArray::Deleter< Type, BaseDeleter >::managed_type = Type

Definition at line 88 of file PackedArray.h.

◆ traits_type

template<typename Type , template< typename > typename BaseDeleter = std::default_delete>
using PackedArray::Deleter< Type, BaseDeleter >::traits_type = detail::ExtendedTraits<managed_type>

Definition at line 90 of file PackedArray.h.

Constructor & Destructor Documentation

◆ Deleter()

template<typename Type , template< typename > typename BaseDeleter = std::default_delete>
PackedArray::Deleter< Type, BaseDeleter >::Deleter ( size_t  size = 0)
inlinenoexcept

Nontrivial, implicit constructor of the deleter takes a size, which defaults to 0 to allow default contruction of the unique_ptr

Definition at line 96 of file PackedArray.h.

97 : mCount{ size
99 : 0
100 }
101 {}
typename traits_type::element_type element_type
Definition: PackedArray.h:92

References PackedArray::detail::ExtendedTraits< T, typename >::element_offset(), and size.

Here is the call graph for this function:

Member Function Documentation

◆ GetCount()

template<typename Type , template< typename > typename BaseDeleter = std::default_delete>
size_t PackedArray::Deleter< Type, BaseDeleter >::GetCount ( ) const
inline

Definition at line 120 of file PackedArray.h.

120{ return mCount; }

References PackedArray::Deleter< Type, BaseDeleter >::mCount.

◆ operator()()

template<typename Type , template< typename > typename BaseDeleter = std::default_delete>
void PackedArray::Deleter< Type, BaseDeleter >::operator() ( Type *  p) const
inlinenoexcept

Definition at line 103 of file PackedArray.h.

107 {
108 if (!p)
109 return;
110 // Do nested deallocations for elements by decreasing subscript
111 auto pE = traits_type::element_ptr(p) + mCount;
112 for (auto count = mCount; count--;)
113 (--pE)->~element_type();
114 // Do nested deallocations for main structure
115 reinterpret_cast<const header_type*>(p)->~header_type();
116 // main deallocation
117 ((base_type&)*this)(p);
118 }
typename traits_type::header_type header_type
Definition: PackedArray.h:91
BaseDeleter< managed_type > base_type
Definition: PackedArray.h:89
static element_type * element_ptr(T *p)
Definition: PackedArray.h:30

References PackedArray::detail::ExtendedTraits< T, typename >::element_ptr(), and PackedArray::Deleter< Type, BaseDeleter >::mCount.

Here is the call graph for this function:

Member Data Documentation

◆ mCount

template<typename Type , template< typename > typename BaseDeleter = std::default_delete>
size_t PackedArray::Deleter< Type, BaseDeleter >::mCount = 0
private

The documentation for this struct was generated from the following file: