Files
ESP8266lib/data/Vector.h
kazu 5cb02880b3 many updates..
new sensors.. display.. led.. drawing.. stuff..
2019-01-17 23:12:01 +01:00

36 lines
438 B
C++

#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