summaryrefslogtreecommitdiff
path: root/utils/small_vector.h
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-11-25 23:24:42 +0000
committerPaul Baltescu <pauldb89@gmail.com>2013-11-25 23:24:42 +0000
commit0febed366e6c3fedd288bc1bddfcd65f247cab81 (patch)
tree5dbe0c5763994aa9d12c5092a9c1b39d87e16540 /utils/small_vector.h
parentbd6fef61505b19989cc327620632e8e7efda2e6e (diff)
parentb6c44f82ffca74cc38cf6039ac9ab3c2c66fd5d6 (diff)
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'utils/small_vector.h')
-rw-r--r--utils/small_vector.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/utils/small_vector.h b/utils/small_vector.h
index c8a69927..280ab72c 100644
--- a/utils/small_vector.h
+++ b/utils/small_vector.h
@@ -14,7 +14,6 @@
#include <stdint.h>
#include <new>
#include <stdint.h>
-#include "swap_pod.h"
#include <boost/functional/hash.hpp>
//sizeof(T)/sizeof(T*)>1?sizeof(T)/sizeof(T*):1
@@ -278,8 +277,15 @@ public:
return !(a==b);
}
- void swap(Self& o) {
- swap_pod(*this,o);
+ inline void swap(Self& o) {
+ const unsigned s=sizeof(SmallVector<T,SV_MAX>);
+ char tmp[s];
+ void *pt=static_cast<void*>(tmp);
+ void *pa=static_cast<void*>(this);
+ void *pb=static_cast<void*>(&o);
+ std::memcpy(pt,pa,s);
+ std::memcpy(pa,pb,s);
+ std::memcpy(pb,pt,s);
}
inline std::size_t hash_impl() const {