Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Rejestrator
myvector.h
00001 #pragma once 00002 00003 template<class T> 00004 class myvector { 00005 public: 00006 myvector() { 00007 m_size = 0; 00008 m_buf = NULL; 00009 } 00010 void push_back(T v) { 00011 T* new_buf = new T[m_size+1]; 00012 if (m_size > 0) { 00013 for(int i = 0; i < m_size; i++) { 00014 new_buf[i] = m_buf[i]; 00015 } 00016 delete[] m_buf; 00017 } 00018 m_buf = new_buf; 00019 m_buf[m_size++] = v; 00020 } 00021 T& operator[](const int index) { 00022 return m_buf[index]; 00023 } 00024 int size() { return m_size; } 00025 00026 private: 00027 int m_size; 00028 T *m_buf; 00029 };
Generated on Sat Jul 30 2022 15:40:23 by
