aboutsummaryrefslogtreecommitdiff
path: root/dep/g3dlite/include/G3D/SmallArray.h
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2014-08-22 16:58:23 +0200
committerjackpoz <giacomopoz@gmail.com>2014-08-22 21:00:56 +0200
commit5e8277e923c5545a15bae7c740ab6afaa597a59f (patch)
tree4cf5212c080588a7e868ee60134fc7fff51e400a /dep/g3dlite/include/G3D/SmallArray.h
parenta63aa858dcb400eafb97eed1f590e34c27d934a4 (diff)
Core/Dependencies: Update G3D to v9.0 r4036
Diffstat (limited to 'dep/g3dlite/include/G3D/SmallArray.h')
-rw-r--r--dep/g3dlite/include/G3D/SmallArray.h53
1 files changed, 41 insertions, 12 deletions
diff --git a/dep/g3dlite/include/G3D/SmallArray.h b/dep/g3dlite/include/G3D/SmallArray.h
index 900d2335ee1..f738e1e8d58 100644
--- a/dep/g3dlite/include/G3D/SmallArray.h
+++ b/dep/g3dlite/include/G3D/SmallArray.h
@@ -1,10 +1,10 @@
/**
- @file SmallArray.h
+ \file G3D/SmallArray.h
- @created 2009-04-26
- @edited 2010-02-26
+ \created 2009-04-26
+ \edited 2012-07-23
- Copyright 2000-2010, Morgan McGuire, http://graphics.cs.williams.edu
+ Copyright 2000-2012, Morgan McGuire, http://graphics.cs.williams.edu
All rights reserved.
*/
#ifndef G3D_SmallArray_h
@@ -83,6 +83,35 @@ public:
push(v);
}
+ inline void append(const T& v, const T& v2) {
+ push(v);
+ push(v2);
+ }
+
+ inline void append(const T& v, const T& v2, const T& v3) {
+ push(v);
+ push(v2);
+ push(v3);
+ }
+
+ inline void append(const T& v, const T& v2, const T& v3, const T& v4) {
+ push(v);
+ push(v2);
+ push(v3);
+ push(v4);
+ }
+
+ /** Find the index of \a v or -1 if not found */
+ int findIndex(const T& v) {
+ for (int i = 0; i < N; ++i) {
+ if (m_embedded[i] == v) {
+ return i;
+ }
+ }
+
+ return m_rest.findIndex(v) + N;
+ }
+
void fastRemove(int i, bool shrinkIfNecessary = false) {
debugAssert(i < m_size && i >= 0);
if (i < N) {
@@ -139,8 +168,8 @@ public:
return m_rest.contains(value);
}
- template<int MIN_ELEMENTS, int MIN_BYTES>
- SmallArray<T, N>& operator=(const Array<T, MIN_ELEMENTS, MIN_BYTES>& src) {
+ template<int MIN_ELEMENTS>
+ SmallArray<T, N>& operator=(const Array<T, MIN_ELEMENTS>& src) {
resize(src.size());
for (int i = 0; i < src.size(); ++i) {
(*this)[i] = src[i];
@@ -148,13 +177,13 @@ public:
return *this;
}
- inline const T& last() const {
- return (*this)[size() - 1];
- }
+ inline const T& last() const {
+ return (*this)[size() - 1];
+ }
- inline T& last() {
- return (*this)[size() - 1];
- }
+ inline T& last() {
+ return (*this)[size() - 1];
+ }
};
}