CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
allocator.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_allocator__
13#define __cxz_allocator__
14
15#include <cstdlib>
16#include <new>
17#include <vector>
18#include <cstdint>
19#include <cassert>
20#include <iostream>
21#include "base/types.h"
22#include "base/intrin.h"
23
24#define MIB_SIZE 1024*1024 // 1MiB
25#define WARN_SIZE MIB_SIZE*100 // 100 MiB
26
27namespace CNORXZ
28{
33 template <typename T>
35 {
36 public:
37
38 typedef T value_type;
39
40 static constexpr SizeT type_size = sizeof(T);
41 static constexpr SizeT N = MAX_VSIZE;
47 struct VX
48 {
49 alignas(N) char x[N];
50 };
51
53 Allocator() = default;
54
59 template <typename U>
61
65 T* allocate(SizeT n);
66
71 void deallocate(T* p, SizeT n);
72 };
73
75 template <class T, class U>
76 bool operator==(const Allocator<T>& a, const Allocator<U>& b);
77
79 template <class T, class U>
80 bool operator!=(const Allocator<T>& a, const Allocator<U>& b);
81
82
83} // namespace CNORXZ
84
85#endif
void deallocate(T *p, SizeT n)
static constexpr SizeT N
Definition allocator.h:41
static constexpr SizeT type_size
Definition allocator.h:40
T * allocate(SizeT n)
Allocator()=default
Allocator(const Allocator< U > &x)
Definition allocator.h:60
Definitions related to intrinsics.
#define MAX_VSIZE
Definition intrin.h:10
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
Declaration of all library types.