New fix for std swap (for gcc >= 3.3)

[SVN r19624]
This commit is contained in:
Fernando Cacciola
2003-08-15 21:27:29 +00:00
parent a38ccb92b5
commit 579269c39e

View File

@ -271,9 +271,11 @@ bool operator != ( optional<T> const& x, optional<T> const& y )
// //
namespace optional_detail { 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): // workaround for GCC (JM):
using std::swap; using std::swap;
#define BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE
#endif #endif
// optional's swap: // optional's swap:
@ -296,13 +298,17 @@ void optional_swap ( optional<T>& x, optional<T>& y )
} }
else if ( !!x && !!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 ; using std::swap ;
#endif #endif
swap(*x,*y); swap(*x,*y);
} }
} }
#undef BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE
} // namespace optional_detail } // namespace optional_detail
template<class T> inline void swap ( optional<T>& x, optional<T>& y ) template<class T> inline void swap ( optional<T>& x, optional<T>& y )