mirror of
https://github.com/boostorg/optional.git
synced 2025-07-29 12:07:21 +02:00
New fix for std swap (for gcc >= 3.3)
[SVN r19624]
This commit is contained in:
@ -271,9 +271,11 @@ bool operator != ( optional<T> const& x, optional<T> 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<T>& x, optional<T>& 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<class T> inline void swap ( optional<T>& x, optional<T>& y )
|
||||
|
Reference in New Issue
Block a user