PandaRoot
PndCAInternal::Allocator< T, alignment > Class Template Reference

#include <PndCAArray.h>

Static Public Member Functions

static T * Alloc (int s)
 
static void Free (T *const p, int size)
 

Detailed Description

template<typename T, int alignment>
class PndCAInternal::Allocator< T, alignment >

Definition at line 191 of file PndCAArray.h.

Member Function Documentation

◆ Alloc()

template<typename T , int alignment>
static T* PndCAInternal::Allocator< T, alignment >::Alloc ( int  s)
inlinestatic

Definition at line 207 of file PndCAArray.h.

Referenced by PndCAResizableArray< T, Dim, alignment >::PndCAResizableArray().

208  {
209  T *p;
210  posix_memalign(&p, alignment, s * sizeof(T));
211  return new (p) T[s];
212  }

◆ Free()

template<typename T , int alignment>
static void PndCAInternal::Allocator< T, alignment >::Free ( T *const  p,
int  size 
)
inlinestatic

Definition at line 213 of file PndCAArray.h.

References i.

Referenced by PndCAResizableArray< T, Dim, alignment >::Resize(), and PndCAResizableArray< T, Dim, alignment >::~PndCAResizableArray().

214  {
215  for (int i = 0; i < size; ++i) {
216  p[i].~T();
217  }
218  std::free(p);
219  }
unsigned int i
Definition: P4_F32vec4.h:33

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