From 579269c39ed512217001f6b1e641ff4ad21fd6ee Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Fri, 15 Aug 2003 21:27:29 +0000 Subject: [PATCH] New fix for std swap (for gcc >= 3.3) [SVN r19624] --- include/boost/optional.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/boost/optional.hpp b/include/boost/optional.hpp index ec4a209..04b72a1 100644 --- a/include/boost/optional.hpp +++ b/include/boost/optional.hpp @@ -271,9 +271,11 @@ bool operator != ( optional const& x, optional const& y ) // namespace optional_detail { -#ifdef __GNUC__ +// GCC <= 3.2 gets the using declaration at namespace scope (FLC) +#if BOOST_WORKAROUND(__GNUC__, <= 3) && __GNUC_MINOR__ <= 2 // workaround for GCC (JM): using std::swap; +#define BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE #endif // optional's swap: @@ -296,13 +298,17 @@ void optional_swap ( optional& x, optional& y ) } else if ( !!x && !!y ) { -#ifndef __GNUC__ +// GCC > 3.2 and all other compilers have the using declaration at function scope (FLC) +#ifndef BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE + // allow for Koenig lookup using std::swap ; #endif swap(*x,*y); } } +#undef BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE + } // namespace optional_detail template inline void swap ( optional& x, optional& y )