Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/containers/vector

    r67cf18c r6dc78dee  
    2222
    2323//------------------------------------------------------------------------------
    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 //------------------------------------------------------------------------------
    5424//Declaration
    5525trait allocator_c(otype T, otype allocator_t)
     
    5929};
    6030
    61 forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
     31forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    6232struct vector;
    6333
     
    7646void ^?{}(vector(T, allocator_t)* this);
    7747
    78 forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
     48forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    7949struct vector
    8050{
     
    166136// }
    167137
     138//------------------------------------------------------------------------------
     139//Allocator
     140forall(otype T)
     141struct heap_allocator
     142{
     143        T* storage;
     144        size_t capacity;
     145};
     146
     147forall(otype T)
     148void ?{}(heap_allocator(T)* this);
     149
     150forall(otype T)
     151void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs);
     152
     153forall(otype T)
     154heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs);
     155
     156forall(otype T)
     157void ^?{}(heap_allocator(T)* this);
     158
     159forall(otype T)
     160void realloc_storage(heap_allocator(T)* this, size_t size);
     161
     162forall(otype T)
     163static 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.