summaryrefslogtreecommitdiff
path: root/utils/small_vector.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-11 02:46:13 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-11 02:46:13 +0000
commit82384b4ec365f3d2ad2c9bca078a0b38d4be09c0 (patch)
treef6f015f2791ec9b1ec94c90c98b09c0d251aee9e /utils/small_vector.h
parente4e66118c14704509e214aa32689ef304ae5ada2 (diff)
merge
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@511 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils/small_vector.h')
-rw-r--r--utils/small_vector.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/small_vector.h b/utils/small_vector.h
index 25c52359..ae1e5727 100644
--- a/utils/small_vector.h
+++ b/utils/small_vector.h
@@ -14,6 +14,7 @@
#include <stdint.h>
#include <new>
#include <stdint.h>
+#include "swap_pod.h"
//sizeof(T)/sizeof(T*)>1?sizeof(T)/sizeof(T*):1
template <class T,int SV_MAX=2>
@@ -245,6 +246,10 @@ public:
return !(a==b);
}
+ void swap(Self& o) const {
+ swap_pod(*this,o);
+ }
+
private:
union StorageType {
T vals[SV_MAX];
@@ -255,6 +260,11 @@ public:
uint16_t capacity_; // only defined when size_ > __SV_MAX_STATIC
};
+template <class T,int SV_MAX>
+inline void swap(SmallVector<T,SV_MAX> &a,SmallVector<T,SV_MAX> &b) {
+ a.swap(b);
+}
+
typedef SmallVector<int,2> SmallVectorInt;
template <class T,int N>