forked from boostorg/optional
Compare commits
6 Commits
boost-1.31
...
svn-tags/m
Author | SHA1 | Date | |
---|---|---|---|
aa6713ff54 | |||
0109fabef4 | |||
dce592e3b2 | |||
05045f5be7 | |||
8d85b4c47b | |||
3ca0557a7c |
@ -921,9 +921,9 @@ assert ( optX != optZ ) ;
|
||||
|
||||
<pre>bool operator < ( optional<T> const& x, optional<T> const& y );</pre>
|
||||
<blockquote>
|
||||
<p><b>Returns:</b> If both <b>x</b> and <b>y</b> are initialied, <code>(*x < *y)</code>.
|
||||
If only x or y is initialized, <code>false</code>. If both are uninitialized,
|
||||
<code>false</code>.
|
||||
<p><b>Returns:</b> If <b>y</b> is not initialized, <code>false</code>.
|
||||
If <b>y</b> is initialized and <b>x</b> is not initialized, <code>true</code>.
|
||||
If both <b>x</b> and <b>y</b> are initialized, <code>(*x < *y)</code>.
|
||||
</p>
|
||||
<p><b>Throws:</b> Nothing.</p>
|
||||
<p><b>Notes:</b> Pointers have shallow relational operators while <b>optional</b> has
|
||||
@ -1407,37 +1407,39 @@ T <u>is not</u> required to be <a href="http://www.sgi.com/tech/stl/DefaultConst
|
||||
Henney, David Abrahams, and others I can't recall. </p>
|
||||
</blockquote>
|
||||
<p>Post-formal review:</p>
|
||||
<blockquote>
|
||||
<p>William Kempf carefully considered the originally proposed interface
|
||||
and suggested the new interface which is currently used. He also started
|
||||
and fueled the discussion about the analogy optional<>/smart pointer
|
||||
and about relational operators.<br>
|
||||
Peter Dimov, Joel de Guzman, David Abrahams, Tanton Gibbs and Ian Hanson
|
||||
focused on the relational semantics of optional (originally undefined);
|
||||
concluding with the fact that the pointer-like interface doesn't make it
|
||||
a pointer so it shall have deep relational operators.<br>
|
||||
Augustus Saunders also explored the different relational
|
||||
semantics between optional<> and a pointer and developed the
|
||||
OptionalPointee concept as an aid against potential conflicts on generic code.<br>
|
||||
Joel de Guzman noticed that optional<> can be seen as an
|
||||
API on top of variant<T,nil_t>.<br>
|
||||
Dave Gomboc explained the meaning and usage of the Haskell analog to optional<>:
|
||||
the Maybe type constructor (analogy originally pointed out by David Sankel).<br>
|
||||
Other comments were posted by Vincent Finn, Anthony Williams, Ed Brey, Rob Stewart,
|
||||
and others.<br>
|
||||
Joel de Guzman made the case for the support of references and helped with the
|
||||
proper semantics.</p>
|
||||
<blockquote>
|
||||
<p>William Kempf carefully considered the originally proposed interface and
|
||||
suggested the new interface which is currently used. He also started and fueled
|
||||
the discussion about the analogy optional<>/smart pointer and about
|
||||
relational operators.<br>
|
||||
Peter Dimov, Joel de Guzman, David Abrahams, Tanton Gibbs and Ian Hanson focused
|
||||
on the relational semantics of optional (originally undefined); concluding
|
||||
with the fact that the pointer-like interface doesn't make it a pointer so
|
||||
it shall have deep relational operators.<br>
|
||||
Augustus Saunders also explored the different relational semantics between
|
||||
optional<> and a pointer and developed the OptionalPointee concept as
|
||||
an aid against potential conflicts on generic code.<br>
|
||||
Joel de Guzman noticed that optional<> can be seen as an API on top
|
||||
of variant<T,nil_t>.<br>
|
||||
Dave Gomboc explained the meaning and usage of the Haskell analog to optional<>:
|
||||
the Maybe type constructor (analogy originally pointed out by David Sankel).<br>
|
||||
Other comments were posted by Vincent Finn, Anthony Williams, Ed Brey, Rob
|
||||
Stewart, and others.<br>
|
||||
Joel de Guzman made the case for the support of references and helped with
|
||||
the proper semantics.<br>
|
||||
Mat Marcus shown the virtues of a value-oriented interface, influencing the
|
||||
current design, and contributed the idea of "none".</p>
|
||||
</blockquote>
|
||||
<HR>
|
||||
|
||||
<P>Revised December 3, 2003</P>
|
||||
<P>© Copyright boost.org 2003. Permission to copy, use, modify, sell and
|
||||
distribute this document is granted provided this copyright notice appears in
|
||||
all copies. This document is provided "as is" without express or
|
||||
implied warranty, and with no claim as to its suitability for any purpose.</P>
|
||||
<P>Revised Jannuary 30, 2004</P>
|
||||
<P>© Copyright boost.org 2003. Permission to copy, use, modify, sell and
|
||||
distribute this document is granted provided this copyright notice appears in
|
||||
all copies. This document is provided "as is" without express or implied
|
||||
warranty, and with no claim as to its suitability for any purpose.</P>
|
||||
<P>Developed by <A HREF="mailto:fernando_cacciola@hotmail.com">Fernando Cacciola</A>,
|
||||
the latest version of this file can be found at <A
|
||||
HREF="http://www.boost.org">www.boost.org</A>, and the boost discussion list at <A
|
||||
HREF="http://www.yahoogroups.com/list/boost">www.yahoogroups.com/list/boost</A>. </P>
|
||||
HREF="http://www.boost.org">www.boost.org</A>, and the boost
|
||||
<A HREF="http://www.boost.org/more/mailing_lists.htm#main">discussion lists</A></P>
|
||||
</BODY>
|
||||
</HTML>
|
@ -426,7 +426,7 @@ class optional : public optional_detail::optional_base<T>
|
||||
// No-throw (assuming T::~T() doesn't)
|
||||
~optional() {}
|
||||
|
||||
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
|
||||
#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION)
|
||||
// Assigns from an expression. See corresponding constructor.
|
||||
// Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED
|
||||
template<class Expr>
|
||||
|
@ -14,26 +14,21 @@
|
||||
|
||||
import testing ;
|
||||
|
||||
project
|
||||
: source-location $(BOOST_ROOT)
|
||||
;
|
||||
{
|
||||
test-suite optional :
|
||||
[ run libs/optional/test/optional_test.cpp ]
|
||||
[ run libs/optional/test/optional_test_tie.cpp ]
|
||||
[ run libs/optional/test/optional_test_references.cpp ]
|
||||
[ run libs/optional/test/optional_test_inplace.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_fail1.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_fail2.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_fail3a.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_fail3b.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_references_fail1a.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_references_fail1b.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_references_fail1c.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_references_fail2.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_references_fail3.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_references_fail4.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_inplace_fail.cpp ]
|
||||
[ compile-fail libs/optional/test/optional_test_inplace_fail2.cpp ]
|
||||
[ run optional_test.cpp ]
|
||||
[ run optional_test_tie.cpp ]
|
||||
[ run optional_test_ref.cpp ]
|
||||
[ run optional_test_inplace.cpp ]
|
||||
[ compile-fail optional_test_fail1.cpp ]
|
||||
[ compile-fail optional_test_fail2.cpp ]
|
||||
[ compile-fail optional_test_fail3a.cpp ]
|
||||
[ compile-fail optional_test_fail3b.cpp ]
|
||||
[ compile-fail optional_test_ref_fail1.cpp ]
|
||||
[ compile-fail optional_test_ref_fail2.cpp ]
|
||||
[ compile-fail optional_test_ref_fail3.cpp ]
|
||||
[ compile-fail optional_test_ref_fail4.cpp ]
|
||||
[ compile-fail optional_test_inplace_fail.cpp ]
|
||||
[ compile-fail optional_test_inplace_fail2.cpp ]
|
||||
;
|
||||
}
|
||||
|
@ -485,21 +485,12 @@ void test_throwing_assign_to_initialized( T const* )
|
||||
|
||||
BOOST_CHECK(!passed);
|
||||
|
||||
|
||||
#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
|
||||
// opt0 was left unmodified
|
||||
check_is_pending_dtor( ARG(T) );
|
||||
check_is_not_pending_copy( ARG(T) );
|
||||
check_instance_count(count, ARG(T) );
|
||||
check_initialized(opt0);
|
||||
#else
|
||||
// opt0 was left uninitialized
|
||||
-- count ;
|
||||
check_is_not_pending_dtor( ARG(T) );
|
||||
check_is_not_pending_copy( ARG(T) );
|
||||
check_instance_count(count, ARG(T) );
|
||||
check_uninitialized(opt0);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user