diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2013-11-28 11:11:22 +0100 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2013-11-28 11:11:22 +0100 |
commit | a6b3d3417c6d8a63c36a0fdc9c7cf06f7b06df9f (patch) | |
tree | b86142bbf686a69cc3c9913faee18e073b8eece0 /utils/small_vector.h | |
parent | 0be26bb330f3a976243c9da1d6908d4aaf033ebe (diff) | |
parent | a5b4f06838585874f200c94028cd4d41d54c4f76 (diff) |
Merge branch 'master' of github.com:pks/cdec-dtrain
Diffstat (limited to 'utils/small_vector.h')
-rw-r--r-- | utils/small_vector.h | 12 |
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 { |