(svn r13227) -Codechange: Apply code style

This commit is contained in:
peter1138 2008-05-24 10:02:49 +00:00
parent fc35ad9ee9
commit 0c47d3fc14

View File

@ -1,11 +1,12 @@
/* $Id$ */ /* $Id$ */
/** @file smallvec.h Simple vector class that allows allocating an item without the need to copy data needlessly. */ /** @file smallvec.h Simple vector class that allows allocating an item without the need to copy this->data needlessly. */
#ifndef SMALLVEC_H #ifndef SMALLVEC_H
#define SMALLVEC_H #define SMALLVEC_H
template <typename T, uint S> struct SmallVector { template <typename T, uint S>
struct SmallVector {
T *data; T *data;
uint items; uint items;
uint capacity; uint capacity;
@ -14,7 +15,7 @@ template <typename T, uint S> struct SmallVector {
~SmallVector() ~SmallVector()
{ {
free(data); free(this->data);
} }
/** /**
@ -22,42 +23,42 @@ template <typename T, uint S> struct SmallVector {
*/ */
T *Append() T *Append()
{ {
if (items == capacity) { if (this->items == this->capacity) {
capacity += S; this->capacity += S;
data = ReallocT(data, capacity); this->data = ReallocT(this->data, this->capacity);
} }
return &data[items++]; return &this->data[this->items++];
} }
const T *Begin() const const T *Begin() const
{ {
return data; return this->data;
} }
T *Begin() T *Begin()
{ {
return data; return this->data;
} }
const T *End() const const T *End() const
{ {
return &data[items]; return &this->data[this->items];
} }
T *End() T *End()
{ {
return &data[items]; return &this->data[this->items];
} }
const T *Get(size_t index) const const T *Get(uint index) const
{ {
return &data[index]; return &this->data[index];
} }
T *Get(size_t index) T *Get(uint index)
{ {
return &data[index]; return &this->data[index];
} }
}; };