Changes in src/libcfa/containers/vector [67cf18c:6dc78dee]
- File:
-
- 1 edited
-
src/libcfa/containers/vector (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/containers/vector
r67cf18c r6dc78dee 22 22 23 23 //------------------------------------------------------------------------------ 24 //Allocator25 forall(otype T)26 struct heap_allocator27 {28 T* storage;29 size_t capacity;30 };31 32 forall(otype T)33 void ?{}(heap_allocator(T)* this);34 35 forall(otype T)36 void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs);37 38 forall(otype T)39 heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs);40 41 forall(otype T)42 void ^?{}(heap_allocator(T)* this);43 44 forall(otype T)45 void realloc_storage(heap_allocator(T)* this, size_t size);46 47 forall(otype T)48 static inline T* data(heap_allocator(T)* this)49 {50 return this->storage;51 }52 53 //------------------------------------------------------------------------------54 24 //Declaration 55 25 trait allocator_c(otype T, otype allocator_t) … … 59 29 }; 60 30 61 forall(otype T, otype allocator_t = heap_allocator(T)| allocator_c(T, allocator_t))31 forall(otype T, otype allocator_t | allocator_c(T, allocator_t)) 62 32 struct vector; 63 33 … … 76 46 void ^?{}(vector(T, allocator_t)* this); 77 47 78 forall(otype T, otype allocator_t = heap_allocator(T)| allocator_c(T, allocator_t))48 forall(otype T, otype allocator_t | allocator_c(T, allocator_t)) 79 49 struct vector 80 50 { … … 166 136 // } 167 137 138 //------------------------------------------------------------------------------ 139 //Allocator 140 forall(otype T) 141 struct heap_allocator 142 { 143 T* storage; 144 size_t capacity; 145 }; 146 147 forall(otype T) 148 void ?{}(heap_allocator(T)* this); 149 150 forall(otype T) 151 void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs); 152 153 forall(otype T) 154 heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs); 155 156 forall(otype T) 157 void ^?{}(heap_allocator(T)* this); 158 159 forall(otype T) 160 void realloc_storage(heap_allocator(T)* this, size_t size); 161 162 forall(otype T) 163 static inline T* data(heap_allocator(T)* this) 164 { 165 return this->storage; 166 } 167 168 168 #endif // VECTOR_H 169 169
Note:
See TracChangeset
for help on using the changeset viewer.