소스 검색

arraylsits can now reserve

banana-cakes
Felix Brendel 6 년 전
부모
커밋
7d8eabf479
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. +7
    -0
      arraylist.hpp

+ 7
- 0
arraylist.hpp 파일 보기

@@ -51,6 +51,13 @@ struct Array_List {
next_index++;
}

void reserve(unsigned int count) {
if (next_index+count <= length) {
length *= 2;
data = (type*)realloc(data, length * sizeof(type));
}
}

type& operator[](int index) {
return data[index];
}


불러오는 중...
취소
저장