summaryrefslogtreecommitdiff
path: root/utils/swap_pod.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
commit2b95390f08d9f556e6207ecff03b4b0fd5ede993 (patch)
tree7a96e837a3e28cfc8258a3c5293ac333d7c3e29e /utils/swap_pod.h
parent467ef6ce78cfe7341a696ebf0948e377be619ae5 (diff)
parent62a2526e69eb1570bf349763fc8bb65179337918 (diff)
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'utils/swap_pod.h')
-rw-r--r--utils/swap_pod.h23
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