#pragma once #include namespace ylib { template struct nolock_array { nolock_array() { m_array = nullptr; m_count = 0; } ~nolock_array(){ free(); } void free(){ if(m_array != nullptr) delete[] m_array; m_array = nullptr; m_count = 0; } void init(const std::vector& value){ if(value.size() == 0) return; m_array = new T[value.size()]; m_count = value.size(); for(size_t i=0;i v; v.resize(m_count+1); for(size_t i=0;i= m_count){ printf("Unlocked array index is too long"); abort(); } return m_array[index]; } inline size_t size() { return m_count; } T* m_array; size_t m_count; }; }