mirror of
https://git.suyu.dev/suyu/ext-boost.git
synced 2025-12-24 00:04:41 +01:00
Update boost to 1.68.0
Keeps the boost libraries up to date. This also silences informational messages that get spammed throughout the build, such as: "Info: Boost.Config is older than your compiler version - probably nothing bad will happen - but you may wish to look for an update Boost version. Define BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE to suppress this message." Which makes the compilation process a lot less noisy on Windows. It's now much easier to actually spot warnings that occur.
This commit is contained in:
parent
d80e506e17
commit
db95c7fe31
191 changed files with 10342 additions and 6193 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
|
||||
// Copyright (C) 2014 - 2017 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
|
||||
|
|
@ -53,25 +53,41 @@
|
|||
#include <boost/move/utility.hpp>
|
||||
#include <boost/none.hpp>
|
||||
#include <boost/utility/compare_pointees.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/optional/optional_fwd.hpp>
|
||||
#include <boost/optional/detail/optional_config.hpp>
|
||||
#include <boost/optional/detail/optional_factory_support.hpp>
|
||||
#include <boost/optional/detail/optional_aligned_storage.hpp>
|
||||
|
||||
namespace boost { namespace optional_detail {
|
||||
|
||||
template <typename T>
|
||||
struct optional_value_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct optional_value_type< ::boost::optional<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
}} // namespace boost::optional_detail
|
||||
|
||||
#ifdef BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL
|
||||
#include <boost/optional/detail/old_optional_implementation.hpp>
|
||||
#else
|
||||
namespace boost {
|
||||
|
||||
|
||||
namespace optional_ns {
|
||||
|
||||
|
||||
// a tag for in-place initialization of contained value
|
||||
struct in_place_init_t
|
||||
{
|
||||
struct init_tag{};
|
||||
explicit in_place_init_t(init_tag){}
|
||||
};
|
||||
};
|
||||
const in_place_init_t in_place_init ((in_place_init_t::init_tag()));
|
||||
|
||||
// a tag for conditional in-place initialization of contained value
|
||||
|
|
@ -81,7 +97,7 @@ struct in_place_init_if_t
|
|||
explicit in_place_init_if_t(init_tag){}
|
||||
};
|
||||
const in_place_init_if_t in_place_init_if ((in_place_init_if_t::init_tag()));
|
||||
|
||||
|
||||
} // namespace optional_ns
|
||||
|
||||
using optional_ns::in_place_init_t;
|
||||
|
|
@ -149,7 +165,7 @@ class optional_base : public optional_tag
|
|||
}
|
||||
#endif
|
||||
|
||||
// Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialzed optional<T>.
|
||||
// Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional<T>.
|
||||
// Can throw if T::T(T const&) does
|
||||
optional_base ( bool cond, argument_type val )
|
||||
:
|
||||
|
|
@ -160,7 +176,7 @@ class optional_base : public optional_tag
|
|||
}
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
// Creates an optional<T> initialized with 'move(val)' IFF cond is true, otherwise creates an uninitialzed optional<T>.
|
||||
// Creates an optional<T> initialized with 'move(val)' IFF cond is true, otherwise creates an uninitialized optional<T>.
|
||||
// Can throw if T::T(T &&) does
|
||||
optional_base ( bool cond, rval_reference_type val )
|
||||
:
|
||||
|
|
@ -251,7 +267,7 @@ class optional_base : public optional_tag
|
|||
construct(rhs.get_impl());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
// Assigns from another optional<T> (deep-moves the rhs value)
|
||||
void assign ( optional_base&& rhs )
|
||||
|
|
@ -268,7 +284,7 @@ class optional_base : public optional_tag
|
|||
construct(boost::move(rhs.get_impl()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Assigns from another _convertible_ optional<U> (deep-copies the rhs value)
|
||||
template<class U>
|
||||
|
|
@ -282,7 +298,7 @@ class optional_base : public optional_tag
|
|||
#else
|
||||
assign_value( static_cast<value_type>(rhs.get()) );
|
||||
#endif
|
||||
|
||||
|
||||
else destroy();
|
||||
}
|
||||
else
|
||||
|
|
@ -315,7 +331,7 @@ class optional_base : public optional_tag
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Assigns from a T (deep-copies the rhs value)
|
||||
void assign ( argument_type val )
|
||||
{
|
||||
|
|
@ -323,7 +339,7 @@ class optional_base : public optional_tag
|
|||
assign_value(val);
|
||||
else construct(val);
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
// Assigns from a T (deep-moves the rhs value)
|
||||
void assign ( rval_reference_type val )
|
||||
|
|
@ -375,7 +391,7 @@ class optional_base : public optional_tag
|
|||
pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; }
|
||||
pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; }
|
||||
|
||||
bool is_initialized() const { return m_initialized ; }
|
||||
bool is_initialized() const BOOST_NOEXCEPT { return m_initialized ; }
|
||||
|
||||
protected :
|
||||
|
||||
|
|
@ -384,7 +400,7 @@ class optional_base : public optional_tag
|
|||
::new (m_storage.address()) value_type(val) ;
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
void construct ( rval_reference_type val )
|
||||
{
|
||||
|
|
@ -410,7 +426,7 @@ class optional_base : public optional_tag
|
|||
destroy();
|
||||
construct(in_place_init, boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
||||
template<class... Args>
|
||||
explicit optional_base ( in_place_init_t, Args&&... args )
|
||||
:
|
||||
|
|
@ -418,7 +434,7 @@ class optional_base : public optional_tag
|
|||
{
|
||||
construct(in_place_init, boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
||||
template<class... Args>
|
||||
explicit optional_base ( in_place_init_if_t, bool cond, Args&&... args )
|
||||
:
|
||||
|
|
@ -434,26 +450,26 @@ class optional_base : public optional_tag
|
|||
::new (m_storage.address()) value_type( boost::forward<Arg>(arg) );
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
|
||||
void construct ( in_place_init_t )
|
||||
{
|
||||
::new (m_storage.address()) value_type();
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
void emplace_assign ( Arg&& arg )
|
||||
{
|
||||
destroy();
|
||||
construct(in_place_init, boost::forward<Arg>(arg)) ;
|
||||
}
|
||||
|
||||
|
||||
void emplace_assign ()
|
||||
{
|
||||
destroy();
|
||||
construct(in_place_init) ;
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit optional_base ( in_place_init_t, Arg&& arg )
|
||||
:
|
||||
|
|
@ -461,14 +477,14 @@ class optional_base : public optional_tag
|
|||
{
|
||||
construct(in_place_init, boost::forward<Arg>(arg));
|
||||
}
|
||||
|
||||
|
||||
explicit optional_base ( in_place_init_t )
|
||||
:
|
||||
m_initialized(false)
|
||||
{
|
||||
construct(in_place_init);
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit optional_base ( in_place_init_if_t, bool cond, Arg&& arg )
|
||||
:
|
||||
|
|
@ -477,7 +493,7 @@ class optional_base : public optional_tag
|
|||
if ( cond )
|
||||
construct(in_place_init, boost::forward<Arg>(arg));
|
||||
}
|
||||
|
||||
|
||||
explicit optional_base ( in_place_init_if_t, bool cond )
|
||||
:
|
||||
m_initialized(false)
|
||||
|
|
@ -487,21 +503,21 @@ class optional_base : public optional_tag
|
|||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
template<class Arg>
|
||||
void construct ( in_place_init_t, const Arg& 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()) value_type( arg );
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
|
||||
void construct ( in_place_init_t )
|
||||
{
|
||||
::new (m_storage.address()) value_type();
|
||||
|
|
@ -514,20 +530,20 @@ class optional_base : public optional_tag
|
|||
destroy();
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
void emplace_assign ( Arg& arg )
|
||||
{
|
||||
destroy();
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
|
||||
void emplace_assign ()
|
||||
{
|
||||
destroy();
|
||||
construct(in_place_init);
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit optional_base ( in_place_init_t, const Arg& arg )
|
||||
: m_initialized(false)
|
||||
|
|
@ -541,13 +557,13 @@ class optional_base : public optional_tag
|
|||
{
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
|
||||
explicit optional_base ( in_place_init_t )
|
||||
: m_initialized(false)
|
||||
{
|
||||
construct(in_place_init);
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit optional_base ( in_place_init_if_t, bool cond, const Arg& arg )
|
||||
: m_initialized(false)
|
||||
|
|
@ -555,15 +571,15 @@ class optional_base : public optional_tag
|
|||
if ( cond )
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit optional_base ( in_place_init_if_t, bool cond, Arg& arg )
|
||||
: m_initialized(false)
|
||||
{
|
||||
if ( cond )
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
explicit optional_base ( in_place_init_if_t, bool cond )
|
||||
: m_initialized(false)
|
||||
{
|
||||
|
|
@ -747,7 +763,7 @@ class optional_base : public optional_tag
|
|||
|
||||
private :
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1900))
|
||||
void destroy_impl ( ) { m_storage.ptr_ref()->~T() ; m_initialized = false ; }
|
||||
#else
|
||||
void destroy_impl ( ) { m_storage.ref().T::~T() ; m_initialized = false ; }
|
||||
|
|
@ -757,8 +773,6 @@ class optional_base : public optional_tag
|
|||
storage_type m_storage ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#include <boost/optional/detail/optional_trivially_copyable_base.hpp>
|
||||
|
||||
// definition of metafunciton is_optional_val_init_candidate
|
||||
|
|
@ -772,7 +786,7 @@ struct is_optional_related
|
|||
{};
|
||||
|
||||
#if !defined(BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT)
|
||||
|
||||
|
||||
template <typename T, typename 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
|
||||
|
|
@ -861,7 +875,7 @@ class optional
|
|||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
// Creates an optional<T> initialized with 'move(val)'.
|
||||
// Can throw if T::T(T &&) does
|
||||
optional ( rval_reference_type val ) : base( boost::forward<T>(val) )
|
||||
optional ( rval_reference_type val ) : base( boost::forward<T>(val) )
|
||||
{}
|
||||
#endif
|
||||
|
||||
|
|
@ -872,7 +886,7 @@ class optional
|
|||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
/// Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional.
|
||||
// Can throw if T::T(T &&) does
|
||||
optional ( bool cond, rval_reference_type val ) : base( cond, boost::forward<T>(val) )
|
||||
optional ( bool cond, rval_reference_type val ) : base( cond, boost::forward<T>(val) )
|
||||
{}
|
||||
#endif
|
||||
|
||||
|
|
@ -884,16 +898,16 @@ class optional
|
|||
template<class U>
|
||||
explicit optional ( optional<U> const& rhs
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS
|
||||
,typename boost::enable_if< optional_detail::is_optional_constructible<T, U const&> >::type* = 0
|
||||
,BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_constructible<T, U const&>, bool>::type = true
|
||||
#endif
|
||||
)
|
||||
:
|
||||
base()
|
||||
{
|
||||
{
|
||||
if ( rhs.is_initialized() )
|
||||
this->construct(rhs.get());
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
// Creates a deep move of another convertible optional<U>
|
||||
// Requires a valid conversion from U to T.
|
||||
|
|
@ -901,7 +915,7 @@ class optional
|
|||
template<class U>
|
||||
explicit optional ( optional<U> && rhs
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS
|
||||
,typename boost::enable_if< optional_detail::is_optional_constructible<T, U> >::type* = 0
|
||||
,BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_constructible<T, U>, bool>::type = true
|
||||
#endif
|
||||
)
|
||||
:
|
||||
|
|
@ -926,10 +940,10 @@ class optional
|
|||
|
||||
|
||||
template<class Expr>
|
||||
explicit optional ( Expr&& expr,
|
||||
BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_val_init_candidate<T, Expr> >::type* = 0
|
||||
)
|
||||
: base(boost::forward<Expr>(expr),boost::addressof(expr))
|
||||
explicit optional ( Expr&& expr,
|
||||
BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_val_init_candidate<T, Expr>, bool>::type = true
|
||||
)
|
||||
: base(boost::forward<Expr>(expr),boost::addressof(expr))
|
||||
{}
|
||||
|
||||
#else
|
||||
|
|
@ -973,7 +987,7 @@ class optional
|
|||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
|
||||
template<class Expr>
|
||||
BOOST_DEDUCED_TYPENAME boost::enable_if<optional_detail::is_optional_val_init_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));
|
||||
|
|
@ -999,7 +1013,7 @@ class optional
|
|||
this->assign(rhs);
|
||||
return *this ;
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
// Move-assigns from another convertible optional<U> (converts && deep-moves the rhs value)
|
||||
// Requires a valid conversion from U to T.
|
||||
|
|
@ -1030,14 +1044,14 @@ class optional
|
|||
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS
|
||||
optional& operator= ( optional && ) = default;
|
||||
#else
|
||||
optional& operator= ( optional && rhs )
|
||||
optional& operator= ( optional && rhs )
|
||||
BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value && ::boost::is_nothrow_move_assignable<T>::value)
|
||||
{
|
||||
this->assign( static_cast<base &&>(rhs) ) ;
|
||||
return *this ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
|
@ -1050,7 +1064,7 @@ class optional
|
|||
this->assign( boost::forward<T_>(val) ) ;
|
||||
return *this ;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
// Assigns from a T (deep-copies the rhs value)
|
||||
|
|
@ -1060,7 +1074,7 @@ class optional
|
|||
this->assign( val ) ;
|
||||
return *this ;
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
// Assigns from a T (deep-moves the rhs value)
|
||||
optional& operator= ( rval_reference_type val )
|
||||
|
|
@ -1069,9 +1083,9 @@ class optional
|
|||
return *this ;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
|
||||
// Assigns from a "none"
|
||||
// Which destroys the current value, if any, leaving this UNINITIALIZED
|
||||
// No-throw (assuming T::~T() doesn't)
|
||||
|
|
@ -1080,7 +1094,7 @@ class optional
|
|||
this->assign( none_ ) ;
|
||||
return *this ;
|
||||
}
|
||||
|
||||
|
||||
#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
// Constructs in-place
|
||||
// upon exception *this is always uninitialized
|
||||
|
|
@ -1089,29 +1103,29 @@ class optional
|
|||
{
|
||||
this->emplace_assign( boost::forward<Args>(args)... );
|
||||
}
|
||||
|
||||
|
||||
template<class... Args>
|
||||
explicit optional ( in_place_init_t, Args&&... args )
|
||||
: base( in_place_init, boost::forward<Args>(args)... )
|
||||
{}
|
||||
|
||||
|
||||
template<class... Args>
|
||||
explicit optional ( in_place_init_if_t, bool cond, Args&&... args )
|
||||
: base( in_place_init_if, cond, boost::forward<Args>(args)... )
|
||||
{}
|
||||
|
||||
|
||||
#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
|
||||
template<class Arg>
|
||||
void emplace ( Arg&& arg )
|
||||
{
|
||||
this->emplace_assign( boost::forward<Arg>(arg) );
|
||||
}
|
||||
|
||||
|
||||
void emplace ()
|
||||
{
|
||||
this->emplace_assign();
|
||||
}
|
||||
|
||||
|
||||
template<class Args>
|
||||
explicit optional ( in_place_init_t, Args&& args )
|
||||
: base( in_place_init, boost::forward<Args>(args) )
|
||||
|
|
@ -1120,12 +1134,12 @@ class optional
|
|||
explicit optional ( in_place_init_t )
|
||||
: base( in_place_init )
|
||||
{}
|
||||
|
||||
|
||||
template<class Args>
|
||||
explicit optional ( in_place_init_if_t, bool cond, Args&& args )
|
||||
: base( in_place_init_if, cond, boost::forward<Args>(args) )
|
||||
{}
|
||||
|
||||
|
||||
explicit optional ( in_place_init_if_t, bool cond )
|
||||
: base( in_place_init_if, cond )
|
||||
{}
|
||||
|
|
@ -1135,23 +1149,23 @@ class optional
|
|||
{
|
||||
this->emplace_assign( arg );
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
void emplace ( Arg& arg )
|
||||
{
|
||||
this->emplace_assign( arg );
|
||||
}
|
||||
|
||||
|
||||
void emplace ()
|
||||
{
|
||||
this->emplace_assign();
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit optional ( in_place_init_t, const Arg& arg )
|
||||
: base( in_place_init, arg )
|
||||
{}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit optional ( in_place_init_t, Arg& arg )
|
||||
: base( in_place_init, arg )
|
||||
|
|
@ -1160,17 +1174,17 @@ class optional
|
|||
explicit optional ( in_place_init_t )
|
||||
: base( in_place_init )
|
||||
{}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit optional ( in_place_init_if_t, bool cond, const Arg& arg )
|
||||
: base( in_place_init_if, cond, arg )
|
||||
{}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit optional ( in_place_init_if_t, bool cond, Arg& arg )
|
||||
: base( in_place_init_if, cond, arg )
|
||||
{}
|
||||
|
||||
{}
|
||||
|
||||
explicit optional ( in_place_init_if_t, bool cond )
|
||||
: base( in_place_init_if, cond )
|
||||
{}
|
||||
|
|
@ -1203,7 +1217,7 @@ class optional
|
|||
// Returns a reference to the value if this is initialized, otherwise,
|
||||
// the behaviour is UNDEFINED
|
||||
// No-throw
|
||||
#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
|
||||
#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
|
||||
reference_const_type operator *() const& { return this->get() ; }
|
||||
reference_type operator *() & { return this->get() ; }
|
||||
reference_type_of_temporary_wrapper operator *() && { return boost::move(this->get()) ; }
|
||||
|
|
@ -1212,42 +1226,42 @@ class optional
|
|||
reference_type operator *() { return this->get() ; }
|
||||
#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
|
||||
#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
|
||||
#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
|
||||
reference_const_type value() const&
|
||||
{
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return this->get() ;
|
||||
else
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
|
||||
|
||||
reference_type value() &
|
||||
{
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return this->get() ;
|
||||
else
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
|
||||
|
||||
reference_type_of_temporary_wrapper value() &&
|
||||
{
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return boost::move(this->get()) ;
|
||||
else
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
|
||||
#else
|
||||
#else
|
||||
reference_const_type value() const
|
||||
{
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return this->get() ;
|
||||
else
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
|
||||
|
||||
reference_type value()
|
||||
{
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return this->get() ;
|
||||
else
|
||||
|
|
@ -1259,16 +1273,16 @@ class optional
|
|||
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
template <class U>
|
||||
value_type value_or ( U&& v ) const&
|
||||
{
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return get();
|
||||
else
|
||||
return boost::forward<U>(v);
|
||||
}
|
||||
|
||||
|
||||
template <class U>
|
||||
value_type value_or ( U&& v ) &&
|
||||
{
|
||||
value_type value_or ( U&& v ) &&
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return boost::move(get());
|
||||
else
|
||||
|
|
@ -1276,7 +1290,7 @@ class optional
|
|||
}
|
||||
#elif !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
template <class U>
|
||||
value_type value_or ( U&& v ) const
|
||||
value_type value_or ( U&& v ) const
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return get();
|
||||
|
|
@ -1285,17 +1299,17 @@ class optional
|
|||
}
|
||||
#else
|
||||
template <class U>
|
||||
value_type value_or ( U const& v ) const
|
||||
{
|
||||
value_type value_or ( U const& v ) const
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return get();
|
||||
else
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
template <class U>
|
||||
value_type value_or ( U& v ) const
|
||||
{
|
||||
value_type value_or ( U& v ) const
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return get();
|
||||
else
|
||||
|
|
@ -1304,7 +1318,7 @@ class optional
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
|
||||
template <typename F>
|
||||
value_type value_or_eval ( F f ) const&
|
||||
{
|
||||
|
|
@ -1313,7 +1327,7 @@ class optional
|
|||
else
|
||||
return f();
|
||||
}
|
||||
|
||||
|
||||
template <typename F>
|
||||
value_type value_or_eval ( F f ) &&
|
||||
{
|
||||
|
|
@ -1322,6 +1336,61 @@ class optional
|
|||
else
|
||||
return f();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename boost::result_of<F(reference_type)>::type> map(F f) &
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(get());
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename boost::result_of<F(reference_const_type)>::type> map(F f) const&
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(get());
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename boost::result_of<F(reference_type_of_temporary_wrapper)>::type> map(F f) &&
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(boost::move(this->get()));
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_type)>::type>::type> flat_map(F f) &
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(get());
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_const_type)>::type>::type> flat_map(F f) const&
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(get());
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_type_of_temporary_wrapper)>::type>::type> flat_map(F f) &&
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(boost::move(get()));
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
#else
|
||||
template <typename F>
|
||||
value_type value_or_eval ( F f ) const
|
||||
|
|
@ -1331,10 +1400,49 @@ class optional
|
|||
else
|
||||
return f();
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename boost::result_of<F(reference_type)>::type> map(F f)
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(get());
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename boost::result_of<F(reference_const_type)>::type> map(F f) const
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(get());
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_type)>::type>::type> flat_map(F f)
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(get());
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
optional<typename optional_detail::optional_value_type<typename boost::result_of<F(reference_const_type)>::type>::type> flat_map(F f) const
|
||||
{
|
||||
if (this->has_value())
|
||||
return f(get());
|
||||
else
|
||||
return none;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
bool has_value() const BOOST_NOEXCEPT { return this->is_initialized() ; }
|
||||
|
||||
bool operator!() const BOOST_NOEXCEPT { return !this->is_initialized() ; }
|
||||
|
||||
|
||||
BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
|
||||
} ;
|
||||
|
||||
|
|
@ -1343,7 +1451,7 @@ class optional
|
|||
#endif // BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL
|
||||
|
||||
namespace boost {
|
||||
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
template<class T>
|
||||
class optional<T&&>
|
||||
|
|
@ -1472,14 +1580,14 @@ get_pointer ( optional<T>& opt )
|
|||
} // namespace boost
|
||||
|
||||
namespace boost {
|
||||
|
||||
|
||||
// The following declaration prevents a bug where operator safe-bool is used upon streaming optional object if you forget the IO header.
|
||||
template<class CharType, class CharTrait>
|
||||
std::basic_ostream<CharType, CharTrait>&
|
||||
operator<<(std::basic_ostream<CharType, CharTrait>& os, optional_detail::optional_tag const&)
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output boost::optional, include header <boost/optional/optional_io.hpp>");
|
||||
return os;
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue