CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
allocator.cc.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_allocator_cc_h__
13#define __cxz_allocator_cc_h__
14
15#include "allocator.h"
16#include "memcount.h"
17
18namespace CNORXZ
19{
20
21 template <typename T>
23 {
24 const SizeT nn = n*type_size;
25 MemCount::add(nn);
26 const SizeT off = nn%N;
27 const SizeT nnx = (off == 0) ? nn : nn + N - off;
28 const SizeT nnd = nnx/N;
29 VX* vx = new VX[nnd];
30 return reinterpret_cast<T*>(vx);
31 }
32
33 template <typename T>
35 {
36 const SizeT nn = n*type_size;
37 MemCount::sub(nn);
38 VX* vx = reinterpret_cast<VX*>(p);
39 delete [] vx;
40 }
41
42 template <class T, class U>
43 bool operator==(const Allocator<T>& a, const Allocator<U>& b)
44 {
45 return true;
46 }
47
48 template <class T, class U>
49 bool operator!=(const Allocator<T>& a, const Allocator<U>& b)
50 {
51 return false;
52 }
53
54}
55
56#endif
Allocator declaration.
void deallocate(T *p, SizeT n)
T * allocate(SizeT n)
MemCount declaration.
uint64_t SizeT
Definition types.h:38
bool operator!=(const Uuid &a, const Uuid &b)
Definition uuid.h:45
Sptr< Range > rangeCast(const RangePtr r)
bool operator==(const Uuid &a, const Uuid &b)
Definition uuid.h:36