summaryrefslogtreecommitdiff
path: root/src/misc
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-05-24 10:02:49 +0000
committerpeter1138 <peter1138@openttd.org>2008-05-24 10:02:49 +0000
commit5f625acb1ad411a0e7206979e42c6363e1ff4d98 (patch)
tree6482ebb882bd8648bed4d168b111921cfc5d22fa /src/misc
parent08671d2e78d3277511d57236eaa74c0d6cb49fa0 (diff)
downloadopenttd-5f625acb1ad411a0e7206979e42c6363e1ff4d98.tar.xz
(svn r13227) -Codechange: Apply code style
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/smallvec.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/misc/smallvec.h b/src/misc/smallvec.h
index d57f29688..984d634ac 100644
--- a/src/misc/smallvec.h
+++ b/src/misc/smallvec.h
@@ -1,11 +1,12 @@
/* $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
#define SMALLVEC_H
-template <typename T, uint S> struct SmallVector {
+template <typename T, uint S>
+struct SmallVector {
T *data;
uint items;
uint capacity;
@@ -14,7 +15,7 @@ template <typename T, uint S> struct SmallVector {
~SmallVector()
{
- free(data);
+ free(this->data);
}
/**
@@ -22,42 +23,42 @@ template <typename T, uint S> struct SmallVector {
*/
T *Append()
{
- if (items == capacity) {
- capacity += S;
- data = ReallocT(data, capacity);
+ if (this->items == this->capacity) {
+ this->capacity += S;
+ this->data = ReallocT(this->data, this->capacity);
}
- return &data[items++];
+ return &this->data[this->items++];
}
const T *Begin() const
{
- return data;
+ return this->data;
}
T *Begin()
{
- return data;
+ return this->data;
}
const T *End() const
{
- return &data[items];
+ return &this->data[this->items];
}
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];
}
};