From a872efdef255789791f5fb05c45d467c824be552 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 7 Dec 2023 08:59:28 +0200 Subject: [PATCH] BAN: implement basic swap This will be improved, currently just works on general type T and moves values between arguments. --- BAN/include/BAN/Swap.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 BAN/include/BAN/Swap.h diff --git a/BAN/include/BAN/Swap.h b/BAN/include/BAN/Swap.h new file mode 100644 index 0000000000..8952eb099a --- /dev/null +++ b/BAN/include/BAN/Swap.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +namespace BAN +{ + + template + void swap(T& lhs, T& rhs) + { + T tmp = move(lhs); + lhs = move(rhs); + rhs = move(tmp); + } + +}