This website works better with JavaScript.
Home
Explore
Help
Sign In
felix
/
ftb
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
arraylsits can now reserve
banana-cakes
Felix Brendel
6 years ago
parent
635af49d52
commit
7d8eabf479
1 changed files
with
7 additions
and
0 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+7
-0
arraylist.hpp
+ 7
- 0
arraylist.hpp
View File
@@ -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];
}
Write
Preview
Loading…
Cancel
Save