From 0c37391aa8995fa0efaf81782470538fbea280a7 Mon Sep 17 00:00:00 2001 From: Yury Melnichek Date: Mon, 16 May 2011 23:49:30 +0200 Subject: [PATCH] Add base/swap.hpp and Swap() function. --- base/base.pro | 1 + base/swap.hpp | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 base/swap.hpp diff --git a/base/base.pro b/base/base.pro index 46702103dc..8c64b168be 100644 --- a/base/base.pro +++ b/base/base.pro @@ -42,6 +42,7 @@ HEADERS += \ logging.hpp \ start_mem_debug.hpp \ stop_mem_debug.hpp \ + swap.hpp \ thread.hpp \ mutex.hpp \ casts.hpp \ diff --git a/base/swap.hpp b/base/swap.hpp new file mode 100644 index 0000000000..354878a8e7 --- /dev/null +++ b/base/swap.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "../std/algorithm.hpp" + +// Calls swap() function using argument dependant lookup. +// Do NOT override this function, but override swap() function instead! +template inline void Swap(T & a, T & b) +{ + using std::swap; + swap(a, b); +}