summaryrefslogtreecommitdiffstats
path: root/raul/Array.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
committerDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
commitc0d0364c030688aa8bfe4ad8dcaa2cffed8c0d04 (patch)
treec559879d17437adfb1aae4fb5fb40bbe6ac2f983 /raul/Array.hpp
parentf60b59b49df6bc298755d49e97bc329b6d6030a1 (diff)
downloadraul-c0d0364c030688aa8bfe4ad8dcaa2cffed8c0d04.tar.gz
raul-c0d0364c030688aa8bfe4ad8dcaa2cffed8c0d04.tar.bz2
raul-c0d0364c030688aa8bfe4ad8dcaa2cffed8c0d04.zip
Strip trailing whitespace.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@1999 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/Array.hpp')
-rw-r--r--raul/Array.hpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/raul/Array.hpp b/raul/Array.hpp
index 62a7622..1094f53 100644
--- a/raul/Array.hpp
+++ b/raul/Array.hpp
@@ -1,15 +1,15 @@
/* This file is part of Raul.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Raul is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
- *
+ *
* Raul is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
+ *
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -26,7 +26,7 @@ namespace Raul {
/** An array.
- *
+ *
* Has a stack-like push_back(), but is NOT a resizeable array (the size given
* to the constructor or alloc method is the maximum number of elements which
* can be pushed).
@@ -39,7 +39,7 @@ public:
if (size > 0)
_elems = new T[size];
}
-
+
Array(size_t size, T initial_value) : _size(size), _top(0), _elems(NULL) {
if (size > 0) {
_elems = new T[size];
@@ -47,7 +47,7 @@ public:
_elems[i] = initial_value;
}
}
-
+
Array(size_t size, const Array<T>& contents) : _size(size), _top(size+1) {
_elems = new T[size];
if (size <= contents.size())
@@ -62,17 +62,17 @@ public:
void alloc(size_t num_elems) {
assert(num_elems > 0);
-
+
delete[] _elems;
_size = num_elems;
_top = 0;
-
+
_elems = new T[num_elems];
}
-
+
void alloc(size_t num_elems, T initial_value) {
assert(num_elems > 0);
-
+
delete[] _elems;
_size = num_elems;
_top = 0;
@@ -81,16 +81,16 @@ public:
for (size_t i=0; i < _size; ++i)
_elems[i] = initial_value;
}
-
+
void push_back(T n) {
assert(_top < _size);
_elems[_top++] = n;
}
-
+
inline size_t size() const { return _size; }
inline T& operator[](size_t i) const { assert(i < _size); return _elems[i]; }
-
+
inline T& at(size_t i) const { assert(i < _size); return _elems[i]; }
private: