#include "memory.hpp" #include "Arduino.h" #include "general.hpp" template memType *malloc_s(unsigned int size) { auto *mem = malloc(size); if (mem == nullptr) { Serial.println("Error: Memory allocation failed"); while (true) {} } return static_cast(mem); } template unique_ptr::unique_ptr(Target *target) { this->_target = target; } template unique_ptr::~unique_ptr() { delete this->_target; } template Target unique_ptr::operator*() const { return *(this->_target); } template Target *unique_ptr::operator->() const { return this->_target; } template unique_ptr make_unique(Args... args) { return unique_ptr(new Target(args...)); }