Changeset 4a368547 for src/libcfa/containers/vector
- Timestamp:
- May 29, 2017, 3:08:47 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 2ab67b9, a029714
- Parents:
- ff98952 (diff), 4c5b972 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/containers/vector
rff98952 r4a368547 22 22 23 23 //------------------------------------------------------------------------------ 24 //Allocator 25 forall(otype T) 26 struct heap_allocator 27 { 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 //------------------------------------------------------------------------------ 24 54 //Declaration 25 55 trait allocator_c(otype T, otype allocator_t) … … 29 59 }; 30 60 31 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))61 forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t)) 32 62 struct vector; 33 63 … … 46 76 void ^?{}(vector(T, allocator_t)* this); 47 77 48 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))78 forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t)) 49 79 struct vector 50 80 { … … 136 166 // } 137 167 138 //------------------------------------------------------------------------------139 //Allocator140 forall(otype T)141 struct heap_allocator142 {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.