diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 02:46:13 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-11 02:46:13 +0000 |
commit | b22b4fb953987d6a19716af8c3f8af73826bcfca (patch) | |
tree | 6db7e6872417c34127db03181ed62b63841e6c8e /utils/small_vector.h | |
parent | 1db7d5bdc95db9515e3c3ce41cefd4e98fc69298 (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.h | 10 |
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> |