Ignore:
Timestamp:
May 29, 2017, 3:08:47 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/containers/vector

    rff98952 r4a368547  
    2222
    2323//------------------------------------------------------------------------------
     24//Allocator
     25forall(otype T)
     26struct heap_allocator
     27{
     28        T* storage;
     29        size_t capacity;
     30};
     31
     32forall(otype T)
     33void ?{}(heap_allocator(T)* this);
     34
     35forall(otype T)
     36void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs);
     37
     38forall(otype T)
     39heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs);
     40
     41forall(otype T)
     42void ^?{}(heap_allocator(T)* this);
     43
     44forall(otype T)
     45void realloc_storage(heap_allocator(T)* this, size_t size);
     46
     47forall(otype T)
     48static inline T* data(heap_allocator(T)* this)
     49{
     50        return this->storage;
     51}
     52
     53//------------------------------------------------------------------------------
    2454//Declaration
    2555trait allocator_c(otype T, otype allocator_t)
     
    2959};
    3060
    31 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
     61forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
    3262struct vector;
    3363
     
    4676void ^?{}(vector(T, allocator_t)* this);
    4777
    48 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
     78forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
    4979struct vector
    5080{
     
    136166// }
    137167
    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 
    168168#endif // VECTOR_H
    169169
Note: See TracChangeset for help on using the changeset viewer.