many updates..
new sensors.. display.. led.. drawing.. stuff..
This commit is contained in:
35
data/Vector.h
Normal file
35
data/Vector.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef DATA_VECTOR_H
|
||||
#define DATA_VECTOR_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
template <typename T> class Vector {
|
||||
|
||||
private:
|
||||
|
||||
T* data = nullptr;
|
||||
size_t nextIdx = 0;
|
||||
size_t total = 8;
|
||||
|
||||
public:
|
||||
|
||||
Vector() {
|
||||
data = (T*) malloc(total*sizeof(T));
|
||||
}
|
||||
|
||||
void push_back(T elem) {
|
||||
data[nextIdx] = elem;
|
||||
++nextIdx;
|
||||
}
|
||||
|
||||
T& operator[] (const size_t idx) {
|
||||
return data[idx];
|
||||
}
|
||||
|
||||
size_t size() const {
|
||||
return nextIdx;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // DATA_VECTOR_H
|
||||
Reference in New Issue
Block a user