>From 3d7cb27802579f2b9b007f895f96a8d2862fffc0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin
Date: Fri, 27 Feb 2015 14:52:53 +0100 Subject: [PATCH] Define global swap() for any_member<>. The default std::swap() implementation doesn't work for swapping arbitrary any_member<> objects as it relies on being able to assign them, but this is impossible with any_member<> which has a non-standard assignment semantics and only supports assigning between objects of the same type. However swapping two any_member<> objects, of whatever types, is perfectly possible, so provide swap() overload allowing to do this. Notice that std::swap() can't be overloaded, hence we this swap() function must be defined in the same namespace as any_member<> itself, i.e. the global one. --- any_member.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/any_member.hpp b/any_member.hpp index 4601e9f..70a9e18 100644 --- a/any_member.hpp +++ b/any_member.hpp @@ -403,6 +403,16 @@ any_member