#ifndef TYPEBUFFER_H #define TYPEBUFFER_H #include "utils/Buffer.h" template class TypedBuffer { Buffer data; public: TypedBuffer(int n) : data(sizeof (T) * n) { } TypedBuffer& add(const T& t) { data.add(t); return *this; } int getLength() const { return data.getLength() / sizeof (T); } int getByteLength() const { return data.getLength(); } operator const T*() const { return reinterpret_cast(static_cast(data)); } }; #endif