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 )