Compare commits

...

4 Commits

Author SHA1 Message Date
4de6323f45 Fix the GCC workaround!
[SVN r19647]
2003-08-16 18:48:23 +00:00
579269c39e New fix for std swap (for gcc >= 3.3)
[SVN r19624]
2003-08-15 21:27:29 +00:00
a38ccb92b5 Fix couple of typos
[SVN r19623]
2003-08-15 21:23:47 +00:00
a78ee6a73a Fixes for optional_test:
Added missing #include

      Upgraded to the latest intel-win32-tools.jam in order to handle
      intel5 compatibility.


[SVN r19595]
2003-08-14 14:40:41 +00:00
3 changed files with 15 additions and 5 deletions

View File

@ -240,7 +240,7 @@ them. The problem resides in the shallow-copy of pointer semantics: if you need
However, it is particularly important that optional<> objects are not mistaken by pointers,
they are not. <u><b>optional&lt;&gt; does not model a pointer</b></u>.
For instance, optional&lt;&gt; has not shallow-copy so does not alias: two different optionals
never refer to the <i>same</i> value (but my have <i>equivalent</i> values).<br>
never refer to the <i>same</i> value (but may have <i>equivalent</i> values).<br>
The difference between an optional&lt;T&gt; and a pointer must be kept in mind, particularly
because the semantics of relational operators are different: since optional&lt;T&gt;
is a value-wrapper, relational operators are deep: they compare optional values;
@ -818,7 +818,7 @@ Using optional&lt;bool&gt; can lead to subtle errors due to the implicit bool co
void foo ( bool v ) ;
void bar()
{
optional&lt;bool&gt; v = try();
optional&lt;bool&gt; v = Try();
// The following intended to pass the <b>value</b> of 'v' to foo():
foo(v);

View File

@ -271,9 +271,11 @@ bool operator != ( optional<T> const& x, optional<T> const& y )
//
namespace optional_detail {
#ifdef __GNUC__
// workaround for GCC (JM):
// GCC < 3.2 gets the using declaration at namespace scope (FLC, DWA)
#if BOOST_WORKAROUND(__GNUC__, < 3) \
|| BOOST_WORKAROUND(__GNUC__, == 3) && __GNUC_MINOR__ <= 2
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 )

View File

@ -16,6 +16,10 @@
#include<stdexcept>
#include<string>
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
# include <boost/get_pointer.hpp>
#endif
#define BOOST_ENABLE_ASSERT_HANDLER
#include "boost/optional.hpp"