Compare commits

..

6 Commits

11 changed files with 72 additions and 241 deletions

View File

@ -21,8 +21,7 @@ jobs:
buildtype: "boost"
packages: ""
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "g++"
sources: ""
llvm_os: ""
@ -34,8 +33,7 @@ jobs:
buildtype: "boost"
packages: "g++-4.7"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "g++-4.7"
sources: ""
llvm_os: ""
@ -47,8 +45,7 @@ jobs:
buildtype: "boost"
packages: "g++-4.8"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "g++-4.8"
sources: ""
llvm_os: ""
@ -60,8 +57,7 @@ jobs:
buildtype: "boost"
packages: "g++-4.9"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "g++-4.9"
sources: ""
llvm_os: ""
@ -73,8 +69,7 @@ jobs:
buildtype: "boost"
packages: "g++-5"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "g++-5"
sources: ""
llvm_os: ""
@ -86,8 +81,7 @@ jobs:
buildtype: "boost"
packages: "g++-6"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "g++-6"
sources: ""
llvm_os: ""
@ -99,8 +93,7 @@ jobs:
buildtype: "boost"
packages: "g++-7"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "g++-7"
sources: ""
llvm_os: ""
@ -112,7 +105,7 @@ jobs:
buildtype: "boost"
packages: ""
packages_to_remove: ""
os: "ubuntu-18.04"
os: "ubuntu-16.04"
cxx: "clang++"
sources: ""
llvm_os: ""
@ -124,8 +117,7 @@ jobs:
buildtype: "boost"
packages: "clang-3.5 libstdc++-4.9-dev"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "clang++-3.5"
sources: ""
llvm_os: "precise"
@ -137,8 +129,7 @@ jobs:
buildtype: "boost"
packages: "clang-3.6"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "clang++-3.6"
sources: ""
llvm_os: "precise"
@ -150,8 +141,7 @@ jobs:
buildtype: "boost"
packages: "clang-3.7"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "clang++-3.7"
sources: ""
llvm_os: "precise"
@ -163,8 +153,7 @@ jobs:
buildtype: "boost"
packages: "clang-3.8 libstdc++-4.9-dev"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "clang++-3.8"
sources: ""
llvm_os: "precise"
@ -176,8 +165,7 @@ jobs:
buildtype: "boost"
packages: "clang-3.9 libstdc++-4.9-dev"
packages_to_remove: ""
os: "ubuntu-20.04"
container: "ubuntu:16.04"
os: "ubuntu-16.04"
cxx: "clang++-3.9"
sources: ""
llvm_os: "precise"
@ -189,7 +177,7 @@ jobs:
buildtype: "boost"
packages: "clang-4.0"
packages_to_remove: ""
os: "ubuntu-20.04"
os: "ubuntu-16.04"
container: "ubuntu:14.04"
cxx: "clang++-4.0"
sources: ""
@ -202,7 +190,7 @@ jobs:
buildtype: "boost"
packages: "clang-5.0"
packages_to_remove: ""
os: "ubuntu-20.04"
os: "ubuntu-16.04"
container: "ubuntu:14.04"
cxx: "clang++-5.0"
sources: ""
@ -222,12 +210,10 @@ jobs:
- name: If running in container, upgrade packages
if: matrix.container != ''
run: |
apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata && apt-get -o Acquire::Retries=3 install -y sudo software-properties-common wget curl apt-transport-https make apt-file sudo unzip libssl-dev build-essential autotools-dev autoconf automake g++ libc++-helpers python ruby cpio gcc-multilib g++-multilib pkgconf python3 ccache libpython-dev
sudo apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata && apt-get -o Acquire::Retries=3 install -y sudo software-properties-common wget curl apt-transport-https make apt-file sudo unzip libssl-dev build-essential autotools-dev autoconf automake g++ libc++-helpers python python-pip ruby cpio gcc-multilib g++-multilib pkgconf python3 python3-pip ccache libpython-dev
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 -y install git
python_version=$(python3 -c 'import sys; print("{0.major}.{0.minor}".format(sys.version_info))')
sudo wget https://bootstrap.pypa.io/pip/$python_version/get-pip.py
sudo python3 get-pip.py
sudo python -m pip install --upgrade pip==20.3.4
sudo /usr/local/bin/pip install cmake
- uses: actions/checkout@v2

View File

@ -1,9 +1,12 @@
# Copyright 2019 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
#
# NOTE: CMake support for Boost.Optional is currently experimental at best
# and the interface is likely to change in the future
cmake_minimum_required( VERSION 3.5...3.20 )
project( boost_optional VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX )
cmake_minimum_required( VERSION 3.5 )
project( BoostOptional )
add_library( boost_optional INTERFACE )
add_library( Boost::optional ALIAS boost_optional )

View File

@ -1,7 +1,7 @@
[/
Boost.Optional
Copyright (c) 2015 - 2021 Andrzej Krzemienski
Copyright (c) 2015 - 2018 Andrzej Krzemienski
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
@ -11,14 +11,6 @@
[section:relnotes Release Notes]
[heading Boost Release 1.79]
* Fixed [@https://github.com/boostorg/optional/issues/98 issue #98].
[heading Boost Release 1.77]
* Fixed [@https://github.com/boostorg/optional/issues/92 issue #92].
[heading Boost Release 1.76]
* Fixed MSVC warning C4702.
@ -32,7 +24,7 @@
[heading Boost Release 1.73]
* Fixed [@https://github.com/boostorg/optional/issues/78 issue #78].
* `boost::none` is now declared as an inline variable (on compilers taht support it): there is only one instance of `boost::none` across all translation units.
* `boost::none` is now declared as an inline variable (on compilers that support it): there is only one instance of `boost::none` across all translation units.
* Fixed a number of compilation errors in GCC 4.4.7 in `optional<T>` for trivial `T`s. Thanks to Robert Leahy for the fix. For details see [@https://github.com/boostorg/optional/pull/80 pr #78].
* Now surpressing warning `-Wweak-vtables`.

View File

@ -28,24 +28,6 @@
</h2></div></div></div>
<h4>
<a name="boost_optional.relnotes.h0"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_79"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_79">Boost
Release 1.79</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
Fixed <a href="https://github.com/boostorg/optional/issues/98" target="_top">issue
#98</a>.
</li></ul></div>
<h4>
<a name="boost_optional.relnotes.h1"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_77"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_77">Boost
Release 1.77</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
Fixed <a href="https://github.com/boostorg/optional/issues/92" target="_top">issue
#92</a>.
</li></ul></div>
<h4>
<a name="boost_optional.relnotes.h2"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_76"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_76">Boost
Release 1.76</a>
</h4>
@ -53,7 +35,7 @@
Fixed MSVC warning C4702.
</li></ul></div>
<h4>
<a name="boost_optional.relnotes.h3"></a>
<a name="boost_optional.relnotes.h1"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_75"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_75">Boost
Release 1.75</a>
</h4>
@ -67,7 +49,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h4"></a>
<a name="boost_optional.relnotes.h2"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_73"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_73">Boost
Release 1.73</a>
</h4>
@ -78,7 +60,7 @@
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">none</span></code> is now declared as an inline variable
(on compilers taht support it): there is only one instance of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">none</span></code> across all translation units.
(on compilers that support it): there is only one instance of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">none</span></code> across all translation units.
</li>
<li class="listitem">
Fixed a number of compilation errors in GCC 4.4.7 in <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span></code> for trivial <code class="computeroutput"><span class="identifier">T</span></code>s.
@ -90,7 +72,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h5"></a>
<a name="boost_optional.relnotes.h3"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_69"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_69">Boost
Release 1.69</a>
</h4>
@ -108,7 +90,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h6"></a>
<a name="boost_optional.relnotes.h4"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_68"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_68">Boost
Release 1.68</a>
</h4>
@ -125,7 +107,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h7"></a>
<a name="boost_optional.relnotes.h5"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_67"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_67">Boost
Release 1.67</a>
</h4>
@ -139,7 +121,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h8"></a>
<a name="boost_optional.relnotes.h6"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_66"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_66">Boost
Release 1.66</a>
</h4>
@ -157,7 +139,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h9"></a>
<a name="boost_optional.relnotes.h7"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_63"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_63">Boost
Release 1.63</a>
</h4>
@ -181,7 +163,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h10"></a>
<a name="boost_optional.relnotes.h8"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_62"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_62">Boost
Release 1.62</a>
</h4>
@ -189,7 +171,7 @@
Fixed <a href="https://svn.boost.org/trac/boost/ticket/12179" target="_top">Trac #12179</a>.
</li></ul></div>
<h4>
<a name="boost_optional.relnotes.h11"></a>
<a name="boost_optional.relnotes.h9"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_61"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_61">Boost
Release 1.61</a>
</h4>
@ -232,7 +214,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h12"></a>
<a name="boost_optional.relnotes.h10"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_60"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_60">Boost
Release 1.60</a>
</h4>
@ -243,7 +225,7 @@
#11203</a>.
</li></ul></div>
<h4>
<a name="boost_optional.relnotes.h13"></a>
<a name="boost_optional.relnotes.h11"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_59"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_59">Boost
Release 1.59</a>
</h4>
@ -257,7 +239,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h14"></a>
<a name="boost_optional.relnotes.h12"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_58"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_58">Boost
Release 1.58</a>
</h4>
@ -293,7 +275,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h15"></a>
<a name="boost_optional.relnotes.h13"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_57"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_57">Boost
Release 1.57</a>
</h4>
@ -303,7 +285,7 @@
to fix C++03 compile error on <code class="computeroutput"><span class="identifier">logic_error</span><span class="special">(</span><span class="string">"..."</span><span class="special">)</span></code>"</em></span>.
</li></ul></div>
<h4>
<a name="boost_optional.relnotes.h16"></a>
<a name="boost_optional.relnotes.h14"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_56"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_56">Boost
Release 1.56</a>
</h4>

View File

@ -145,7 +145,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: November 20, 2021 at 00:57:52 GMT</small></p></td>
<td align="left"><p><small>Last revised: March 10, 2021 at 22:06:01 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
// Copyright (C) 2014 - 2021 Andrzej Krzemienski.
// Copyright (C) 2014 - 2018 Andrzej Krzemienski.
//
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -18,9 +18,7 @@
#define BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP
#include <new>
#ifndef BOOST_NO_IOSTREAM
#include <iosfwd>
#endif // BOOST_NO_IOSTREAM
#ifdef BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
# include <type_traits>
@ -37,18 +35,14 @@
#include <boost/type.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/conjunction.hpp>
#include <boost/type_traits/disjunction.hpp>
#include <boost/type_traits/has_nothrow_constructor.hpp>
#include <boost/type_traits/type_with_alignment.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/decay.hpp>
#include <boost/type_traits/is_assignable.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_constructible.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
#include <boost/type_traits/is_nothrow_move_assignable.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
@ -129,7 +123,6 @@ class optional_base : public optional_tag
protected :
typedef T value_type ;
typedef typename boost::remove_const<T>::type unqualified_value_type;
protected:
typedef T & reference_type ;
@ -406,14 +399,14 @@ class optional_base : public optional_tag
void construct ( argument_type val )
{
::new (m_storage.address()) unqualified_value_type(val) ;
::new (m_storage.address()) value_type(val) ;
m_initialized = true ;
}
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
void construct ( rval_reference_type val )
{
::new (m_storage.address()) unqualified_value_type( boost::move(val) ) ;
::new (m_storage.address()) value_type( boost::move(val) ) ;
m_initialized = true ;
}
#endif
@ -425,7 +418,7 @@ class optional_base : public optional_tag
template<class... Args>
void construct ( in_place_init_t, Args&&... args )
{
::new (m_storage.address()) unqualified_value_type( boost::forward<Args>(args)... ) ;
::new (m_storage.address()) value_type( boost::forward<Args>(args)... ) ;
m_initialized = true ;
}
@ -456,13 +449,13 @@ class optional_base : public optional_tag
template<class Arg>
void construct ( in_place_init_t, Arg&& arg )
{
::new (m_storage.address()) unqualified_value_type( boost::forward<Arg>(arg) );
::new (m_storage.address()) value_type( boost::forward<Arg>(arg) );
m_initialized = true ;
}
void construct ( in_place_init_t )
{
::new (m_storage.address()) unqualified_value_type();
::new (m_storage.address()) value_type();
m_initialized = true ;
}
@ -516,20 +509,20 @@ class optional_base : public optional_tag
template<class Arg>
void construct ( in_place_init_t, const Arg& arg )
{
::new (m_storage.address()) unqualified_value_type( arg );
::new (m_storage.address()) value_type( arg );
m_initialized = true ;
}
template<class Arg>
void construct ( in_place_init_t, Arg& arg )
{
::new (m_storage.address()) unqualified_value_type( arg );
::new (m_storage.address()) value_type( arg );
m_initialized = true ;
}
void construct ( in_place_init_t )
{
::new (m_storage.address()) unqualified_value_type();
::new (m_storage.address()) value_type();
m_initialized = true ;
}
@ -674,7 +667,7 @@ class optional_base : public optional_tag
template<class Expr>
void construct ( Expr&& expr, void const* )
{
new (m_storage.address()) unqualified_value_type(boost::forward<Expr>(expr)) ;
new (m_storage.address()) value_type(boost::forward<Expr>(expr)) ;
m_initialized = true ;
}
@ -695,7 +688,7 @@ class optional_base : public optional_tag
template<class Expr>
void construct ( Expr const& expr, void const* )
{
new (m_storage.address()) unqualified_value_type(expr) ;
new (m_storage.address()) value_type(expr) ;
m_initialized = true ;
}
@ -733,7 +726,7 @@ class optional_base : public optional_tag
{
// An exception can be thrown here.
// It it happens, THIS will be left uninitialized.
new (m_storage.address()) unqualified_value_type(boost::move(expr.get())) ;
new (m_storage.address()) value_type(boost::move(expr.get())) ;
m_initialized = true ;
}
}
@ -746,7 +739,7 @@ class optional_base : public optional_tag
{
// An exception can be thrown here.
// It it happens, THIS will be left uninitialized.
new (m_storage.address()) unqualified_value_type(expr.get()) ;
new (m_storage.address()) value_type(expr.get()) ;
m_initialized = true ;
}
}
@ -786,7 +779,7 @@ class optional_base : public optional_tag
// definition of metafunction is_optional_val_init_candidate
template <typename U>
struct is_optional_or_tag
struct is_optional_related
: boost::conditional< boost::is_base_of<optional_detail::optional_tag, BOOST_DEDUCED_TYPENAME boost::decay<U>::type>::value
|| boost::is_same<BOOST_DEDUCED_TYPENAME boost::decay<U>::type, none_t>::value
|| boost::is_same<BOOST_DEDUCED_TYPENAME boost::decay<U>::type, in_place_init_t>::value
@ -794,22 +787,14 @@ struct is_optional_or_tag
boost::true_type, boost::false_type>::type
{};
template <typename T, typename U>
struct has_dedicated_constructor
: boost::disjunction<is_optional_or_tag<U>, boost::is_same<T, BOOST_DEDUCED_TYPENAME boost::decay<U>::type> >
{};
template <typename U>
struct is_in_place_factory
: boost::disjunction< boost::is_base_of<boost::in_place_factory_base, BOOST_DEDUCED_TYPENAME boost::decay<U>::type>,
boost::is_base_of<boost::typed_in_place_factory_base, BOOST_DEDUCED_TYPENAME boost::decay<U>::type> >
{};
#if !defined(BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT)
template <typename T, typename U>
struct is_factory_or_constructible_to_T
: boost::disjunction< is_in_place_factory<U>, boost::is_constructible<T, U&&> >
struct is_convertible_to_T_or_factory
: boost::conditional< boost::is_base_of<boost::in_place_factory_base, BOOST_DEDUCED_TYPENAME boost::decay<U>::type>::value
|| boost::is_base_of<boost::typed_in_place_factory_base, BOOST_DEDUCED_TYPENAME boost::decay<U>::type>::value
|| (boost::is_constructible<T, U&&>::value && !boost::is_same<T, BOOST_DEDUCED_TYPENAME boost::decay<U>::type>::value)
, boost::true_type, boost::false_type>::type
{};
template <typename T, typename U>
@ -819,7 +804,7 @@ struct is_optional_constructible : boost::is_constructible<T, U>
#else
template <typename, typename>
struct is_factory_or_constructible_to_T : boost::true_type
struct is_convertible_to_T_or_factory : boost::true_type
{};
template <typename T, typename U>
@ -828,58 +813,15 @@ struct is_optional_constructible : boost::true_type
#endif // is_convertible condition
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
// for is_assignable
#if (!defined BOOST_NO_CXX11_RVALUE_REFERENCES)
// On some initial rvalue reference implementations GCC does it in a strange way,
// preferring perfect-forwarding constructor to implicit copy constructor.
template <typename T, typename U>
struct is_opt_assignable
: boost::conjunction<boost::is_convertible<U&&, T>, boost::is_assignable<T&, U&&> >
{};
#else
template <typename T, typename U>
struct is_opt_assignable
: boost::conjunction<boost::is_convertible<U, T>, boost::is_assignable<T&, U> >
{};
#endif
#else
template <typename T, typename U>
struct is_opt_assignable : boost::is_convertible<U, T>
{};
#endif
template <typename T, typename U>
struct is_factory_or_opt_assignable_to_T
: boost::disjunction< is_in_place_factory<U>, is_opt_assignable<T, U> >
{};
template <typename T, typename U, bool = has_dedicated_constructor<T, U>::value>
template <typename T, typename U, bool = is_optional_related<U>::value>
struct is_optional_val_init_candidate
: boost::false_type
{};
template <typename T, typename U>
struct is_optional_val_init_candidate<T, U, false>
: is_factory_or_constructible_to_T<T, U>
{};
template <typename T, typename U, bool = has_dedicated_constructor<T, U>::value>
struct is_optional_val_assign_candidate
: boost::false_type
{};
template <typename T, typename U>
struct is_optional_val_assign_candidate<T, U, false>
: is_factory_or_opt_assignable_to_T<T, U>
: boost::conditional< is_convertible_to_T_or_factory<T, U>::value
, boost::true_type, boost::false_type>::type
{};
} // namespace optional_detail
@ -1052,7 +994,7 @@ class optional
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
template<class Expr>
BOOST_DEDUCED_TYPENAME boost::enable_if<optional_detail::is_optional_val_assign_candidate<T, Expr>, optional&>::type
BOOST_DEDUCED_TYPENAME boost::enable_if<optional_detail::is_optional_val_init_candidate<T, Expr>, optional&>::type
operator= ( Expr&& expr )
{
this->assign_expr(boost::forward<Expr>(expr),boost::addressof(expr));
@ -1644,7 +1586,6 @@ get_pointer ( optional<T>& opt )
} // namespace boost
#ifndef BOOST_NO_IOSTREAM
namespace boost {
// The following declaration prevents a bug where operator safe-bool is used upon streaming optional object if you forget the IO header.
@ -1657,7 +1598,6 @@ operator<<(std::basic_ostream<CharType, CharTrait>& os, optional_detail::optiona
}
} // namespace boost
#endif // BOOST_NO_IOSTREAM
#include <boost/optional/detail/optional_relops.hpp>
#include <boost/optional/detail/optional_swap.hpp>

View File

@ -12,7 +12,6 @@
#ifndef BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
#define BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
#ifndef BOOST_NO_IOSTREAM
#include <istream>
#include <ostream>
@ -32,7 +31,7 @@ operator<<(std::basic_ostream<CharType, CharTrait>& out, none_t)
{
out << "--";
}
return out;
}
@ -91,5 +90,5 @@ operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v)
} // namespace boost
#endif // BOOST_NO_IOSTREAM
#endif

View File

@ -22,7 +22,6 @@ import testing ;
[ run optional_test_swap.cpp ]
[ run optional_test_conversions_from_U.cpp ]
[ run optional_test_convert_from_T.cpp ]
[ run optional_test_convert_assign.cpp ]
[ run optional_test_empty_braces.cpp ]
[ run optional_test_make_optional.cpp ]
[ run optional_test_flat_map.cpp ]

View File

@ -12,9 +12,7 @@
// Revisions:
// 12 May 2008 (added more swap tests)
//
#ifndef BOOST_NO_IOSTREAM
#include<iostream>
#endif // BOOST_NO_IOSTREAM
#include<stdexcept>
#include<string>
@ -910,7 +908,7 @@ void test_no_implicit_conversions()
// Test for support for classes with overridden operator&
class CustomAddressOfClass
class CustomAddressOfClass
{
int n;
@ -952,3 +950,5 @@ int main()
return boost::report_errors();
}

View File

@ -1,57 +0,0 @@
// Copyright (C) 2021 Andrzej Krzemienski.
//
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/lib/optional for documentation.
//
// You are welcome to contact the author at:
// akrzemi1@gmail.com
#include "boost/optional/optional.hpp"
#include "boost/core/lightweight_test.hpp"
#include "boost/none.hpp"
//#ifndef BOOST_OPTIONAL_NO_CONVERTING_COPY_CTOR
using boost::optional;
struct implicit_bool_conv
{
operator bool() const { return false; }
};
struct explicit_bool_conv
{
bool operator!() const BOOST_NOEXCEPT { return false; }
BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
};
template <typename To, typename From>
void test_convert_assign()
{
optional<To> oi;
oi = From();
BOOST_TEST(oi);
}
void test_no_bad_assignment()
{
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
// this means that type trait `boost::is_assignable` works.
BOOST_STATIC_ASSERT((boost::is_assignable<optional<bool>&, bool>::value));
BOOST_STATIC_ASSERT((boost::is_assignable<optional<bool>&, implicit_bool_conv>::value));
BOOST_STATIC_ASSERT((! boost::is_assignable<optional<bool>&, explicit_bool_conv>::value));
#endif
}
int main()
{
test_convert_assign<int, short>();
test_convert_assign<bool, implicit_bool_conv>();
test_no_bad_assignment();
return boost::report_errors();
}

View File

@ -10,19 +10,15 @@
// You are welcome to contact the author at:
// fernando_cacciola@hotmail.com
#include <sstream>
#include "boost/optional/optional.hpp"
#include "boost/optional/optional_io.hpp"
#include "boost/core/lightweight_test.hpp"
#ifndef BOOST_NO_IOSTREAM
#include <sstream>
#ifdef BOOST_BORLANDC
#pragma hdrstop
#endif
#include "boost/core/lightweight_test.hpp"
using boost::optional;
@ -33,7 +29,7 @@ void test2( Opt o, Opt buff )
const int markv = 123 ;
int mark = 0 ;
s << o << " " << markv ;
s >> buff >> mark ;
@ -89,12 +85,3 @@ int main()
return boost::report_errors();
}
#else // BOOST_NO_IOSTREAM
int main()
{
return boost::report_errors();
}
#endif // BOOST_NO_IOSTREAM