summaryrefslogtreecommitdiff
path: root/src/misc/array.hpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2015-08-08 10:06:24 +0000
committeralberth <alberth@openttd.org>2015-08-08 10:06:24 +0000
commitb885d79f506bde93b4ab278b3f84b8ca6254f3b9 (patch)
treeed7e027c4444181baab5b4ef6b667cd179f29a65 /src/misc/array.hpp
parent9cadc0e1504cf979c14e1cb42bfe51a29675dd81 (diff)
downloadopenttd-b885d79f506bde93b4ab278b3f84b8ca6254f3b9.tar.xz
(svn r27362) -Codechange: Codestyle fixes for reference var declarations, static cast type, operator methods.
Diffstat (limited to 'src/misc/array.hpp')
-rw-r--r--src/misc/array.hpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/misc/array.hpp b/src/misc/array.hpp
index a3f243e10..9796f18ea 100644
--- a/src/misc/array.hpp
+++ b/src/misc/array.hpp
@@ -34,7 +34,7 @@ protected:
{
uint super_size = data.Length();
if (super_size > 0) {
- SubArray& s = data[super_size - 1];
+ SubArray &s = data[super_size - 1];
if (!s.IsFull()) return s;
}
return *data.AppendC();
@@ -62,17 +62,17 @@ public:
/** allocate and construct new item */
inline T *AppendC() { return FirstFreeSubArray().AppendC(); }
/** indexed access (non-const) */
- inline T& operator [] (uint index)
+ inline T& operator[](uint index)
{
- const SubArray& s = data[index / B];
- T& item = s[index % B];
+ const SubArray &s = data[index / B];
+ T &item = s[index % B];
return item;
}
/** indexed access (const) */
- inline const T& operator [] (uint index) const
+ inline const T& operator[](uint index) const
{
- const SubArray& s = data[index / B];
- const T& item = s[index % B];
+ const SubArray &s = data[index / B];
+ const T &item = s[index % B];
return item;
}
@@ -87,7 +87,7 @@ public:
dmp.WriteLine("num_items = %d", num_items);
CStrA name;
for (uint i = 0; i < num_items; i++) {
- const T& item = (*this)[i];
+ const T &item = (*this)[i];
name.Format("item[%d]", i);
dmp.WriteStructT(name.Data(), &item);
}