I have been implementing a visual debugger in my application using another bit of source code. I ran into an issue when I stumbled across them using this..
struct DebugVertex
{
gkVector3 v;
unsigned int color;
};
typedef utArray<DebugVertex> Buffer;
I found the free library that they are using for utArray, however I like to stick with the included libraries when possible (it seems like they used external libs just cause). This is what the definition of utArray looks like…
template <typename T>
class utArray
{
public:
typedef T *Pointer;
typedef const T *ConstPointer;
typedef T ValueType;
typedef const T ConstValueType;
typedef T &ReferenceType;
typedef const T &ConstReferenceType;
typedef utArrayIterator<utArray<T> > Iterator;
typedef const utArrayIterator<utArray<T> > ConstIterator;
public:
utArray() : m_size(0), m_capacity(0), m_data(0), m_cache(0) {}
utArray(const utArray<T>& o)
: m_size(o.size()), m_capacity(0), m_data(0), m_cache(0)
{
reserve(m_size);
copy(m_data, o.m_data, m_size);
}
Is there anything similar I can use? I am not experienced defining a type based on a struct array so any help would be appreciated.
From all standard sequence STL containers probably
vector&dequeare closest to an array (at least to me, I associate random access with arrays…).The only problem you would have is that STL containers have different naming conventions for the internal typedefs like: iterator, pointer, value type & so on. If you really like typing
Buffer::Iteratorinstead ofBuffer::iteratorthen you’ll need to have a proxy type over the STL type of your choosing. Something like: