forked from boostorg/optional
Merge branch 'develop'
This commit is contained in:
28
CMakeLists.txt
Normal file
28
CMakeLists.txt
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# 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 )
|
||||||
|
project( BoostOptional )
|
||||||
|
|
||||||
|
add_library( boost_optional INTERFACE )
|
||||||
|
add_library( Boost::optional ALIAS boost_optional )
|
||||||
|
|
||||||
|
target_include_directories( boost_optional INTERFACE include )
|
||||||
|
|
||||||
|
target_link_libraries( boost_optional
|
||||||
|
INTERFACE
|
||||||
|
Boost::assert
|
||||||
|
Boost::config
|
||||||
|
Boost::core
|
||||||
|
Boost::detail
|
||||||
|
Boost::move
|
||||||
|
Boost::predef
|
||||||
|
Boost::static_assert
|
||||||
|
Boost::throw_exception
|
||||||
|
Boost::type_traits
|
||||||
|
Boost::utility
|
||||||
|
)
|
@ -11,6 +11,11 @@
|
|||||||
|
|
||||||
[section:relnotes Release Notes]
|
[section:relnotes Release Notes]
|
||||||
|
|
||||||
|
[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.
|
||||||
|
|
||||||
[heading Boost Release 1.69]
|
[heading Boost Release 1.69]
|
||||||
|
|
||||||
* Remove deprecation mark from `reset()` method (without arguments).
|
* Remove deprecation mark from `reset()` method (without arguments).
|
||||||
|
@ -28,6 +28,21 @@
|
|||||||
</h2></div></div></div>
|
</h2></div></div></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h0"></a>
|
<a name="boost_optional.relnotes.h0"></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>
|
||||||
|
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||||
|
<li class="listitem">
|
||||||
|
Fixed <a href="https://github.com/boostorg/optional/issues/78" target="_top">issue
|
||||||
|
#78</a>.
|
||||||
|
</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.
|
||||||
|
</li>
|
||||||
|
</ul></div>
|
||||||
|
<h4>
|
||||||
|
<a name="boost_optional.relnotes.h1"></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
|
<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>
|
Release 1.69</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -45,7 +60,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h1"></a>
|
<a name="boost_optional.relnotes.h2"></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
|
<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>
|
Release 1.68</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -62,7 +77,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h2"></a>
|
<a name="boost_optional.relnotes.h3"></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
|
<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>
|
Release 1.67</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -76,7 +91,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h3"></a>
|
<a name="boost_optional.relnotes.h4"></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
|
<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>
|
Release 1.66</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -94,7 +109,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h4"></a>
|
<a name="boost_optional.relnotes.h5"></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
|
<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>
|
Release 1.63</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -118,7 +133,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h5"></a>
|
<a name="boost_optional.relnotes.h6"></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
|
<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>
|
Release 1.62</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -126,7 +141,7 @@
|
|||||||
Fixed <a href="https://svn.boost.org/trac/boost/ticket/12179" target="_top">Trac #12179</a>.
|
Fixed <a href="https://svn.boost.org/trac/boost/ticket/12179" target="_top">Trac #12179</a>.
|
||||||
</li></ul></div>
|
</li></ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h6"></a>
|
<a name="boost_optional.relnotes.h7"></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
|
<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>
|
Release 1.61</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -169,7 +184,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h7"></a>
|
<a name="boost_optional.relnotes.h8"></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
|
<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>
|
Release 1.60</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -180,7 +195,7 @@
|
|||||||
#11203</a>.
|
#11203</a>.
|
||||||
</li></ul></div>
|
</li></ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h8"></a>
|
<a name="boost_optional.relnotes.h9"></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
|
<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>
|
Release 1.59</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -194,7 +209,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h9"></a>
|
<a name="boost_optional.relnotes.h10"></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
|
<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>
|
Release 1.58</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -230,7 +245,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h10"></a>
|
<a name="boost_optional.relnotes.h11"></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
|
<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>
|
Release 1.57</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -240,7 +255,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>.
|
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>
|
</li></ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h11"></a>
|
<a name="boost_optional.relnotes.h12"></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
|
<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>
|
Release 1.56</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||||
<td align="left"><p><small>Last revised: November 08, 2018 at 17:44:53 GMT</small></p></td>
|
<td align="left"><p><small>Last revised: December 19, 2019 at 23:27:43 GMT</small></p></td>
|
||||||
<td align="right"><div class="copyright-footer"></div></td>
|
<td align="right"><div class="copyright-footer"></div></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#ifndef BOOST_NONE_17SEP2003_HPP
|
#ifndef BOOST_NONE_17SEP2003_HPP
|
||||||
#define BOOST_NONE_17SEP2003_HPP
|
#define BOOST_NONE_17SEP2003_HPP
|
||||||
|
|
||||||
|
#include "boost/config.hpp"
|
||||||
#include "boost/none_t.hpp"
|
#include "boost/none_t.hpp"
|
||||||
|
|
||||||
// NOTE: Borland users have to include this header outside any precompiled headers
|
// NOTE: Borland users have to include this header outside any precompiled headers
|
||||||
@ -23,7 +24,7 @@ namespace boost {
|
|||||||
|
|
||||||
#ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE
|
#ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE
|
||||||
|
|
||||||
none_t const none = (static_cast<none_t>(0)) ;
|
BOOST_INLINE_VARIABLE none_t const none = (static_cast<none_t>(0)) ;
|
||||||
|
|
||||||
#elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE
|
#elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ namespace detail { namespace optional_detail {
|
|||||||
{
|
{
|
||||||
static const T instance;
|
static const T instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T none_instance<T>::instance = T(); // global, but because 'tis a template, no cpp file required
|
const T none_instance<T>::instance = T(); // global, but because 'tis a template, no cpp file required
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ namespace {
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
const none_t none ((none_t::init_tag()));
|
BOOST_INLINE_VARIABLE const none_t none ((none_t::init_tag()));
|
||||||
|
|
||||||
#endif // older definitions
|
#endif // older definitions
|
||||||
|
|
||||||
|
@ -777,7 +777,7 @@ class optional_base : public optional_tag
|
|||||||
|
|
||||||
#include <boost/optional/detail/optional_trivially_copyable_base.hpp>
|
#include <boost/optional/detail/optional_trivially_copyable_base.hpp>
|
||||||
|
|
||||||
// definition of metafunciton is_optional_val_init_candidate
|
// definition of metafunction is_optional_val_init_candidate
|
||||||
template <typename U>
|
template <typename U>
|
||||||
struct is_optional_related
|
struct is_optional_related
|
||||||
: boost::conditional< boost::is_base_of<optional_detail::optional_tag, BOOST_DEDUCED_TYPENAME boost::decay<U>::type>::value
|
: boost::conditional< boost::is_base_of<optional_detail::optional_tag, BOOST_DEDUCED_TYPENAME boost::decay<U>::type>::value
|
||||||
@ -813,9 +813,14 @@ struct is_optional_constructible : boost::true_type
|
|||||||
|
|
||||||
#endif // is_convertible condition
|
#endif // is_convertible condition
|
||||||
|
|
||||||
template <typename T, typename U>
|
template <typename T, typename U, bool = is_optional_related<U>::value>
|
||||||
struct is_optional_val_init_candidate
|
struct is_optional_val_init_candidate
|
||||||
: boost::conditional< !is_optional_related<U>::value && is_convertible_to_T_or_factory<T, U>::value
|
: boost::false_type
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
struct is_optional_val_init_candidate<T, U, false>
|
||||||
|
: boost::conditional< is_convertible_to_T_or_factory<T, U>::value
|
||||||
, boost::true_type, boost::false_type>::type
|
, boost::true_type, boost::false_type>::type
|
||||||
{};
|
{};
|
||||||
|
|
||||||
@ -967,7 +972,7 @@ class optional
|
|||||||
// Can throw if T::T(T&&) does
|
// Can throw if T::T(T&&) does
|
||||||
|
|
||||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS
|
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS
|
||||||
optional ( optional && rhs ) = default;
|
optional ( optional && ) = default;
|
||||||
#else
|
#else
|
||||||
optional ( optional && rhs )
|
optional ( optional && rhs )
|
||||||
BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value)
|
BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value)
|
||||||
|
@ -50,6 +50,7 @@ import testing ;
|
|||||||
[ run optional_test_member_T.cpp ]
|
[ run optional_test_member_T.cpp ]
|
||||||
[ run optional_test_tc_base.cpp ]
|
[ run optional_test_tc_base.cpp ]
|
||||||
[ compile optional_test_sfinae_friendly_ctor.cpp ]
|
[ compile optional_test_sfinae_friendly_ctor.cpp ]
|
||||||
|
[ compile optional_test_path_assignment.cpp ]
|
||||||
[ compile-fail optional_test_fail_const_swap.cpp ]
|
[ compile-fail optional_test_fail_const_swap.cpp ]
|
||||||
[ compile-fail optional_test_ref_convert_assign_const_int_prevented.cpp ]
|
[ compile-fail optional_test_ref_convert_assign_const_int_prevented.cpp ]
|
||||||
[ compile-fail optional_test_fail1.cpp ]
|
[ compile-fail optional_test_fail1.cpp ]
|
||||||
|
69
test/optional_test_path_assignment.cpp
Normal file
69
test/optional_test_path_assignment.cpp
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// Copyright (C) 2019 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"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename, typename>
|
||||||
|
struct void_t
|
||||||
|
{
|
||||||
|
typedef void type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T, typename = void>
|
||||||
|
struct trait
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// the following trait emulates properties std::iterator_traits
|
||||||
|
template <typename T>
|
||||||
|
struct trait<T, BOOST_DEDUCED_TYPENAME void_t<BOOST_DEDUCED_TYPENAME T::value_type,
|
||||||
|
BOOST_DEDUCED_TYPENAME boost::enable_if<boost::is_constructible<T, T&> >::type
|
||||||
|
>::type>
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME T::value_type value_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// This class emulates the properties of std::filesystem::path
|
||||||
|
struct Path
|
||||||
|
{
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103
|
||||||
|
template <typename T, typename = BOOST_DEDUCED_TYPENAME trait<T>::value_type>
|
||||||
|
Path(T const&);
|
||||||
|
#else
|
||||||
|
template <typename T>
|
||||||
|
Path(T const&, BOOST_DEDUCED_TYPENAME trait<T>::value_type* = 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
#ifndef BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT
|
||||||
|
#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS
|
||||||
|
|
||||||
|
boost::optional<Path> optFs1;
|
||||||
|
boost::optional<Path> optFs2;
|
||||||
|
|
||||||
|
optFs1 = optFs2;
|
||||||
|
|
||||||
|
// the following still fails although it shouldn't
|
||||||
|
//BOOST_STATIC_ASSERT((std::is_copy_constructible<boost::optional<Path>>::value));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
Reference in New Issue
Block a user