From 82384b4ec365f3d2ad2c9bca078a0b38d4be09c0 Mon Sep 17 00:00:00 2001 From: graehl Date: Wed, 11 Aug 2010 02:46:13 +0000 Subject: merge git-svn-id: https://ws10smt.googlecode.com/svn/trunk@511 ec762483-ff6d-05da-a07a-a48fb63a330f --- utils/small_vector.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'utils/small_vector.h') 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 #include #include +#include "swap_pod.h" //sizeof(T)/sizeof(T*)>1?sizeof(T)/sizeof(T*):1 template @@ -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 +inline void swap(SmallVector &a,SmallVector &b) { + a.swap(b); +} + typedef SmallVector SmallVectorInt; template -- cgit v1.2.3