1 #ifndef NPSTAT_ALLOCATORS_HH_
2 #define NPSTAT_ALLOCATORS_HH_
22 inline T*
makeBuffer(
unsigned sizeNeeded,
T* stackBuffer,
unsigned sizeofStackBuffer) {
23 if (sizeNeeded > sizeofStackBuffer || stackBuffer ==
nullptr)
24 return new T[sizeNeeded];
32 if (thisBuffer != stackBuffer)
37 template <
typename T1,
typename T2>
42 for (
unsigned long i = 0;
i < len; ++
i)
43 *dest++ = static_cast<T1>(*source++);
51 template <
typename T1,
typename T2>
56 for (
unsigned long i = 0;
i < dim; ++
i) {
57 for (
unsigned long j = 0;
j < dim; ++
j)
58 dest[
j * dim] = static_cast<T1>(*source++);
68 template <
typename T1,
typename T2>
73 for (
unsigned long i = 0;
i < M; ++
i) {
74 for (
unsigned long j = 0;
j <
N; ++
j)
75 dest[
j * M] = static_cast<T1>(*source++);
90 for (
unsigned long i = 0;
i < len; ++
i)
96 #endif // NPSTAT_ALLOCATORS_HH_
void copyBuffer(T1 *dest, const T2 *source, const unsigned long len)
T * makeBuffer(unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
void transposeBuffer(T1 *dest, const T2 *source, const unsigned long dim)
void clearBuffer(T *buf, const unsigned long len)
static std::string const source
void destroyBuffer(T *thisBuffer, const T *stackBuffer)