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 | ab02696b1c104febc7f13c896acf4165f2721018 (patch) | |
tree | 61969895daa79d1d67c90f4adc1de7d91ef3cdfd /utils/swap_pod.h | |
parent | ab63f2f2988e0093a721d0599c7fe68e183561d8 (diff) | |
parent | e346cd5cd3c5d7164819c35e485a9850d825996e (diff) |
Merge branch 'master' of github.com:pks/cdec-dtrain
Diffstat (limited to 'utils/swap_pod.h')
-rw-r--r-- | utils/swap_pod.h | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/utils/swap_pod.h b/utils/swap_pod.h deleted file mode 100644 index bb9a830d..00000000 --- a/utils/swap_pod.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SWAP_POD_H -#define SWAP_POD_H - -//for swapping objects of the same concrete type where just swapping their bytes will work. will at least work on plain old data. - -#include <algorithm> // not used, but people who use this will want to bring std::swap in anyway -#include <cstring> - -template <class T> -inline void swap_pod(T &a,T &b) { - using namespace std; - const unsigned s=sizeof(T); - char tmp[s]; - void *pt=(void*)tmp; - void *pa=(void*)&a; - void *pb=(void*)&b; - memcpy(pt,pa,s); - memcpy(pa,pb,s); - memcpy(pb,pt,s); -} - - -#endif |