DynArray/README.md

49 lines
726 B
Markdown
Raw Permalink Normal View History

2021-11-21 00:51:26 +02:00
# DynArray: Basic dynamic array (list/vector) implementation
2021-11-21 00:38:43 +02:00
Why? Why not.
2021-11-21 00:53:17 +02:00
## How to use?
```cpp
#include "dynarray.hpp"
2021-11-21 00:55:18 +02:00
// And then later in code
DynArray<int> arr;
arr << 5;
// Classic for:
for (int i = 0; i < arr.size(); i++) {
// Do stuff with arr[i]
}
// Range based for:
for (auto elem : arr) {
// Do stuff with elem
}
2021-11-21 00:53:17 +02:00
```
## How to run example?
2021-11-21 00:38:43 +02:00
### Got make?
```shell
make run
```
### No make?
```shell
g++ example.cpp -o example
./example
```
### Windows?
```powershell
g++ example.cpp -o example.exe
.\example.exe
```
### Windows without `g++`?
I never compiled something using `msvc` from the terminal. I guess make a new Visual Studio project, copy-paste the files in there and have fun, idk.