Closures 25
This commit is contained in:
parent
1a614ac45b
commit
dc4e6d33b2
16 changed files with 422 additions and 209 deletions
|
|
@ -5,7 +5,7 @@ import clox.memory;
|
|||
struct DynArray(T){
|
||||
private size_t _count;
|
||||
private size_t _capacity;
|
||||
ref size_t count() => _count;
|
||||
size_t count() => _count;
|
||||
size_t capacity() => _capacity;
|
||||
// TODO capacity setter
|
||||
T* ptr;
|
||||
|
|
@ -14,7 +14,7 @@ struct DynArray(T){
|
|||
_capacity = 0;
|
||||
ptr = null;
|
||||
}
|
||||
void opOpAssign(string op: "~")(in T value){
|
||||
void opOpAssign(string op: "~")(T value){
|
||||
if(capacity < count + 1){
|
||||
size_t oldCapacity = capacity;
|
||||
_capacity = GROW_CAPACITY(oldCapacity);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue