update boost
This commit is contained in:
@@ -19,6 +19,11 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wweak-vtables"
|
||||
#endif
|
||||
|
||||
class bad_optional_access : public std::logic_error
|
||||
{
|
||||
public:
|
||||
@@ -27,6 +32,10 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
@@ -79,7 +79,7 @@ class optional_base : public optional_tag
|
||||
private :
|
||||
|
||||
typedef
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
#endif
|
||||
::boost::detail::make_reference_content<T>::type internal_type ;
|
||||
@@ -336,7 +336,7 @@ class optional_base : public optional_tag
|
||||
// No-throw (assuming T::~T() doesn't)
|
||||
void reset() BOOST_NOEXCEPT { destroy(); }
|
||||
|
||||
// **DEPPRECATED** Replaces the current value -if any- with 'val'
|
||||
// **DEPRECATED** Replaces the current value -if any- with 'val'
|
||||
void reset ( argument_type val ) { assign(val); }
|
||||
|
||||
// Returns a pointer to the value if this is initialized, otherwise,
|
||||
@@ -542,7 +542,7 @@ class optional_base : public optional_tag
|
||||
// Thus, the following overload is needed to properly handle the case when the 'lhs'
|
||||
// is another optional.
|
||||
//
|
||||
// For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error
|
||||
// For VC<=70 compilers this workaround doesn't work because the compiler issues and error
|
||||
// instead of choosing the wrong overload
|
||||
//
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
@@ -619,7 +619,7 @@ class optional_base : public optional_tag
|
||||
reference_const_type dereference( internal_type const* p, is_reference_tag ) const { return p->get() ; }
|
||||
reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; }
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
|
||||
void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; }
|
||||
#else
|
||||
void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->~T() ; m_initialized = false ; }
|
||||
@@ -629,7 +629,7 @@ class optional_base : public optional_tag
|
||||
|
||||
// If T is of reference type, trying to get a pointer to the held value must result in a compile-time error.
|
||||
// Decent compilers should disallow conversions from reference_content<T>* to T*, but just in case,
|
||||
// the following olverloads are used to filter out the case and guarantee an error in case of T being a reference.
|
||||
// the following overloads are used to filter out the case and guarantee an error in case of T being a reference.
|
||||
pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; }
|
||||
pointer_type cast_ptr( internal_type * p, is_not_reference_tag ) { return p ; }
|
||||
pointer_const_type cast_ptr( internal_type const* p, is_reference_tag ) const { return &p->get() ; }
|
||||
|
||||
@@ -28,7 +28,7 @@ class aligned_storage
|
||||
// BOOST_MAY_ALIAS works around GCC warnings about breaking strict aliasing rules when casting storage address to T*
|
||||
union BOOST_MAY_ALIAS dummy_u
|
||||
{
|
||||
char data[ sizeof(T) ];
|
||||
unsigned char data[ sizeof(T) ];
|
||||
BOOST_DEDUCED_TYPENAME type_with_alignment<
|
||||
::boost::alignment_of<T>::value >::type aligner_;
|
||||
} dummy_ ;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
# define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551)
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x551)
|
||||
// BCB (5.5.1) cannot parse the nested template struct in an inplace factory.
|
||||
# define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
|
||||
#endif
|
||||
@@ -53,7 +53,7 @@
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && _MSC_VER <= 1800)
|
||||
// on MSCV 2013 and earlier an unwanted temporary is created when you assign from
|
||||
// on MSVC 2013 and earlier an unwanted temporary is created when you assign from
|
||||
// a const lvalue of integral type. Thus we bind not to the original address but
|
||||
// to a temporary.
|
||||
# define BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT
|
||||
@@ -114,9 +114,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
// Detect suport for defaulting move operations
|
||||
// Detect support for defaulting move operations
|
||||
// (some older compilers implement rvalue references,
|
||||
// defaulted funcitons but move operations are not special members and cannot be defaulted)
|
||||
// defaulted functions but move operations are not special members and cannot be defaulted)
|
||||
|
||||
#ifdef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
# define BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS
|
||||
|
||||
49
linx64/include/boost/optional/detail/optional_hash.hpp
Normal file
49
linx64/include/boost/optional/detail/optional_hash.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (C) 2022 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/libs/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// akrzemi1@gmail.com
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_HASH_AJK_20MAY2022_HPP
|
||||
#define BOOST_OPTIONAL_DETAIL_OPTIONAL_HASH_AJK_20MAY2022_HPP
|
||||
|
||||
#include <boost/optional/optional_fwd.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_OPTIONAL_CONFIG_DO_NOT_SPECIALIZE_STD_HASH) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <typename T>
|
||||
struct hash<boost::optional<T> >
|
||||
{
|
||||
typedef std::size_t result_type;
|
||||
typedef boost::optional<T> argument_type;
|
||||
|
||||
BOOST_CONSTEXPR result_type operator()(const argument_type& arg) const {
|
||||
return arg ? std::hash<T>()(*arg) : result_type();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct hash<boost::optional<T&> >
|
||||
{
|
||||
typedef std::size_t result_type;
|
||||
typedef boost::optional<T&> argument_type;
|
||||
|
||||
BOOST_CONSTEXPR result_type operator()(const argument_type& arg) const {
|
||||
return arg ? std::hash<T>()(*arg) : result_type();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // !defined(BOOST_OPTIONAL_CONFIG_DO_NOT_SPECIALIZE_STD_HASH) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
|
||||
|
||||
#endif // header guard
|
||||
@@ -66,7 +66,7 @@ void prevent_assignment_from_false_const_integral()
|
||||
{
|
||||
#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES
|
||||
#ifdef BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT
|
||||
// MSVC compiler without rvalue refernces: we need to disable the asignment from
|
||||
// MSVC compiler without rvalue references: we need to disable the assignment from
|
||||
// const integral lvalue reference, as it may be an invalid temporary
|
||||
BOOST_STATIC_ASSERT_MSG(!is_const_integral<From>::value,
|
||||
"binding const lvalue references to integral types is disabled in this compiler");
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
explicit optional(const optional<U&>& rhs) BOOST_NOEXCEPT : ptr_(rhs.get_ptr()) {}
|
||||
optional(const optional& rhs) BOOST_NOEXCEPT : ptr_(rhs.get_ptr()) {}
|
||||
|
||||
// the following two implement a 'conditionally explicit' constructor: condition is a hack for buggy compilers with srewed conversion construction from const int
|
||||
// the following two implement a 'conditionally explicit' constructor: condition is a hack for buggy compilers with screwed conversion construction from const int
|
||||
template <class U>
|
||||
explicit optional(U& rhs, BOOST_DEDUCED_TYPENAME boost::enable_if_c<detail::is_same_decayed<T, U>::value && detail::is_const_integral_bad_for_conversion<U>::value, bool>::type = true) BOOST_NOEXCEPT
|
||||
: ptr_(boost::addressof(rhs)) {}
|
||||
@@ -151,7 +151,14 @@ public:
|
||||
T* get_ptr() const BOOST_NOEXCEPT { return ptr_; }
|
||||
T* operator->() const { BOOST_ASSERT(ptr_); return ptr_; }
|
||||
T& operator*() const { BOOST_ASSERT(ptr_); return *ptr_; }
|
||||
T& value() const { return ptr_ ? *ptr_ : (throw_exception(bad_optional_access()), *ptr_); }
|
||||
|
||||
T& value() const
|
||||
{
|
||||
if (this->is_initialized())
|
||||
return this->get();
|
||||
else
|
||||
throw_exception(bad_optional_access());
|
||||
}
|
||||
|
||||
bool operator!() const BOOST_NOEXCEPT { return ptr_ == 0; }
|
||||
BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
namespace boost {
|
||||
|
||||
// optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values).
|
||||
// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead.
|
||||
// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointees() in generic code instead.
|
||||
|
||||
|
||||
//
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
// trivilally-copyable version of the storage
|
||||
// Copyright (C) 2017 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/libs/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// akrzemi1@gmail.com
|
||||
|
||||
// trivially-copyable version of the storage
|
||||
|
||||
template<class T>
|
||||
class tc_optional_base : public optional_tag
|
||||
@@ -69,7 +80,7 @@ class tc_optional_base : public optional_tag
|
||||
// ~tc_optional_base() = default;
|
||||
|
||||
// Assigns from another optional<T> (deep-copies the rhs value)
|
||||
void assign ( tc_optional_base const& rhs )
|
||||
void assign ( tc_optional_base const& rhs )
|
||||
{
|
||||
*this = rhs;
|
||||
}
|
||||
@@ -84,7 +95,7 @@ class tc_optional_base : public optional_tag
|
||||
#else
|
||||
m_storage = static_cast<value_type>(rhs.get());
|
||||
#endif
|
||||
|
||||
|
||||
m_initialized = rhs.is_initialized();
|
||||
}
|
||||
|
||||
@@ -99,7 +110,7 @@ class tc_optional_base : public optional_tag
|
||||
m_initialized = rhs.is_initialized();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void assign ( argument_type val )
|
||||
{
|
||||
construct(val);
|
||||
@@ -131,7 +142,7 @@ class tc_optional_base : public optional_tag
|
||||
// No-throw (assuming T::~T() doesn't)
|
||||
void reset() BOOST_NOEXCEPT { destroy(); }
|
||||
|
||||
// **DEPPRECATED** Replaces the current value -if any- with 'val'
|
||||
// **DEPRECATED** Replaces the current value -if any- with 'val'
|
||||
void reset ( argument_type val ) BOOST_NOEXCEPT { assign(val); }
|
||||
|
||||
// Returns a pointer to the value if this is initialized, otherwise,
|
||||
@@ -166,7 +177,7 @@ class tc_optional_base : public optional_tag
|
||||
{
|
||||
construct(in_place_init, boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
||||
template<class... Args>
|
||||
explicit tc_optional_base ( in_place_init_t, Args&&... args )
|
||||
:
|
||||
@@ -174,7 +185,7 @@ class tc_optional_base : public optional_tag
|
||||
{
|
||||
construct(in_place_init, boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
||||
template<class... Args>
|
||||
explicit tc_optional_base ( in_place_init_if_t, bool cond, Args&&... args )
|
||||
:
|
||||
@@ -190,24 +201,24 @@ class tc_optional_base : public optional_tag
|
||||
m_storage = value_type( boost::forward<Arg>(arg) );
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
|
||||
void construct ( in_place_init_t )
|
||||
{
|
||||
m_storage = value_type();
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
void emplace_assign ( Arg&& arg )
|
||||
{
|
||||
construct(in_place_init, boost::forward<Arg>(arg)) ;
|
||||
}
|
||||
|
||||
|
||||
void emplace_assign ()
|
||||
{
|
||||
construct(in_place_init) ;
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit tc_optional_base ( in_place_init_t, Arg&& arg )
|
||||
:
|
||||
@@ -215,11 +226,11 @@ class tc_optional_base : public optional_tag
|
||||
{
|
||||
construct(in_place_init, boost::forward<Arg>(arg));
|
||||
}
|
||||
|
||||
|
||||
explicit tc_optional_base ( in_place_init_t )
|
||||
:
|
||||
m_initialized(false), m_storage() {}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit tc_optional_base ( in_place_init_if_t, bool cond, Arg&& arg )
|
||||
:
|
||||
@@ -228,7 +239,7 @@ class tc_optional_base : public optional_tag
|
||||
if ( cond )
|
||||
construct(in_place_init, boost::forward<Arg>(arg));
|
||||
}
|
||||
|
||||
|
||||
explicit tc_optional_base ( in_place_init_if_t, bool cond )
|
||||
:
|
||||
m_initialized(false)
|
||||
@@ -238,21 +249,21 @@ class tc_optional_base : public optional_tag
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
template<class Arg>
|
||||
void construct ( in_place_init_t, const Arg& arg )
|
||||
{
|
||||
m_storage = value_type( arg );
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
void construct ( in_place_init_t, Arg& arg )
|
||||
{
|
||||
m_storage = value_type( arg );
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
|
||||
void construct ( in_place_init_t )
|
||||
{
|
||||
m_storage = value_type();
|
||||
@@ -264,18 +275,18 @@ class tc_optional_base : public optional_tag
|
||||
{
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
void emplace_assign ( Arg& arg )
|
||||
{
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
|
||||
void emplace_assign ()
|
||||
{
|
||||
construct(in_place_init);
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit tc_optional_base ( in_place_init_t, const Arg& arg )
|
||||
: m_initialized(false)
|
||||
@@ -289,13 +300,13 @@ class tc_optional_base : public optional_tag
|
||||
{
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
|
||||
explicit tc_optional_base ( in_place_init_t )
|
||||
: m_initialized(false)
|
||||
{
|
||||
construct(in_place_init);
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit tc_optional_base ( in_place_init_if_t, bool cond, const Arg& arg )
|
||||
: m_initialized(false)
|
||||
@@ -303,15 +314,15 @@ class tc_optional_base : public optional_tag
|
||||
if ( cond )
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
|
||||
template<class Arg>
|
||||
explicit tc_optional_base ( in_place_init_if_t, bool cond, Arg& arg )
|
||||
: m_initialized(false)
|
||||
{
|
||||
if ( cond )
|
||||
construct(in_place_init, arg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
explicit tc_optional_base ( in_place_init_if_t, bool cond )
|
||||
: m_initialized(false)
|
||||
{
|
||||
@@ -359,7 +370,7 @@ class tc_optional_base : public optional_tag
|
||||
template<class Expr>
|
||||
void construct ( Expr const& factory, in_place_factory_base const* )
|
||||
{
|
||||
boost_optional_detail::construct<value_type>(factory, m_storage.address());
|
||||
boost_optional_detail::construct<value_type>(factory, boost::addressof(m_storage));
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
@@ -444,7 +455,7 @@ class tc_optional_base : public optional_tag
|
||||
// Thus, the following overload is needed to properly handle the case when the 'lhs'
|
||||
// is another optional.
|
||||
//
|
||||
// For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error
|
||||
// For VC<=70 compilers this workaround doesn't work because the compiler issues and error
|
||||
// instead of choosing the wrong overload
|
||||
//
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
|
||||
// Copyright (C) 2014 - 2018 Andrzej Krzemienski.
|
||||
// Copyright (C) 2014 - 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
|
||||
@@ -18,7 +18,9 @@
|
||||
#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>
|
||||
@@ -35,14 +37,18 @@
|
||||
#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>
|
||||
@@ -59,6 +65,7 @@
|
||||
#include <boost/optional/detail/optional_config.hpp>
|
||||
#include <boost/optional/detail/optional_factory_support.hpp>
|
||||
#include <boost/optional/detail/optional_aligned_storage.hpp>
|
||||
#include <boost/optional/detail/optional_hash.hpp>
|
||||
|
||||
namespace boost { namespace optional_detail {
|
||||
|
||||
@@ -123,6 +130,7 @@ 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 ;
|
||||
@@ -384,7 +392,7 @@ class optional_base : public optional_tag
|
||||
// No-throw (assuming T::~T() doesn't)
|
||||
void reset() BOOST_NOEXCEPT { destroy(); }
|
||||
|
||||
// **DEPPRECATED** Replaces the current value -if any- with 'val'
|
||||
// **DEPRECATED** Replaces the current value -if any- with 'val'
|
||||
void reset ( argument_type val ) { assign(val); }
|
||||
|
||||
// Returns a pointer to the value if this is initialized, otherwise,
|
||||
@@ -399,14 +407,14 @@ class optional_base : public optional_tag
|
||||
|
||||
void construct ( argument_type val )
|
||||
{
|
||||
::new (m_storage.address()) value_type(val) ;
|
||||
::new (m_storage.address()) unqualified_value_type(val) ;
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
void construct ( rval_reference_type val )
|
||||
{
|
||||
::new (m_storage.address()) value_type( boost::move(val) ) ;
|
||||
::new (m_storage.address()) unqualified_value_type( boost::move(val) ) ;
|
||||
m_initialized = true ;
|
||||
}
|
||||
#endif
|
||||
@@ -418,7 +426,7 @@ class optional_base : public optional_tag
|
||||
template<class... Args>
|
||||
void construct ( in_place_init_t, Args&&... args )
|
||||
{
|
||||
::new (m_storage.address()) value_type( boost::forward<Args>(args)... ) ;
|
||||
::new (m_storage.address()) unqualified_value_type( boost::forward<Args>(args)... ) ;
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
@@ -449,13 +457,13 @@ class optional_base : public optional_tag
|
||||
template<class Arg>
|
||||
void construct ( in_place_init_t, Arg&& arg )
|
||||
{
|
||||
::new (m_storage.address()) value_type( boost::forward<Arg>(arg) );
|
||||
::new (m_storage.address()) unqualified_value_type( boost::forward<Arg>(arg) );
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
void construct ( in_place_init_t )
|
||||
{
|
||||
::new (m_storage.address()) value_type();
|
||||
::new (m_storage.address()) unqualified_value_type();
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
@@ -509,20 +517,20 @@ class optional_base : public optional_tag
|
||||
template<class Arg>
|
||||
void construct ( in_place_init_t, const Arg& arg )
|
||||
{
|
||||
::new (m_storage.address()) value_type( arg );
|
||||
::new (m_storage.address()) unqualified_value_type( arg );
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
template<class Arg>
|
||||
void construct ( in_place_init_t, Arg& arg )
|
||||
{
|
||||
::new (m_storage.address()) value_type( arg );
|
||||
::new (m_storage.address()) unqualified_value_type( arg );
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
void construct ( in_place_init_t )
|
||||
{
|
||||
::new (m_storage.address()) value_type();
|
||||
::new (m_storage.address()) unqualified_value_type();
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
@@ -667,7 +675,7 @@ class optional_base : public optional_tag
|
||||
template<class Expr>
|
||||
void construct ( Expr&& expr, void const* )
|
||||
{
|
||||
new (m_storage.address()) value_type(boost::forward<Expr>(expr)) ;
|
||||
new (m_storage.address()) unqualified_value_type(boost::forward<Expr>(expr)) ;
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
@@ -688,7 +696,7 @@ class optional_base : public optional_tag
|
||||
template<class Expr>
|
||||
void construct ( Expr const& expr, void const* )
|
||||
{
|
||||
new (m_storage.address()) value_type(expr) ;
|
||||
new (m_storage.address()) unqualified_value_type(expr) ;
|
||||
m_initialized = true ;
|
||||
}
|
||||
|
||||
@@ -714,7 +722,7 @@ class optional_base : public optional_tag
|
||||
// Thus, the following overload is needed to properly handle the case when the 'lhs'
|
||||
// is another optional.
|
||||
//
|
||||
// For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error
|
||||
// For VC<=70 compilers this workaround doesn't work because the compiler issues and error
|
||||
// instead of choosing the wrong overload
|
||||
//
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||
@@ -726,7 +734,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()) value_type(boost::move(expr.get())) ;
|
||||
new (m_storage.address()) unqualified_value_type(boost::move(expr.get())) ;
|
||||
m_initialized = true ;
|
||||
}
|
||||
}
|
||||
@@ -739,7 +747,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()) value_type(expr.get()) ;
|
||||
new (m_storage.address()) unqualified_value_type(expr.get()) ;
|
||||
m_initialized = true ;
|
||||
}
|
||||
}
|
||||
@@ -777,9 +785,9 @@ class optional_base : public optional_tag
|
||||
|
||||
#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>
|
||||
struct is_optional_related
|
||||
struct is_optional_or_tag
|
||||
: 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
|
||||
@@ -787,14 +795,22 @@ struct is_optional_related
|
||||
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_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
|
||||
struct is_factory_or_constructible_to_T
|
||||
: boost::disjunction< is_in_place_factory<U>, boost::is_constructible<T, U&&> >
|
||||
{};
|
||||
|
||||
template <typename T, typename U>
|
||||
@@ -804,7 +820,7 @@ struct is_optional_constructible : boost::is_constructible<T, U>
|
||||
#else
|
||||
|
||||
template <typename, typename>
|
||||
struct is_convertible_to_T_or_factory : boost::true_type
|
||||
struct is_factory_or_constructible_to_T : boost::true_type
|
||||
{};
|
||||
|
||||
template <typename T, typename U>
|
||||
@@ -813,10 +829,58 @@ 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>
|
||||
struct is_optional_val_init_candidate
|
||||
: boost::conditional< !is_optional_related<U>::value && is_convertible_to_T_or_factory<T, U>::value
|
||||
, boost::true_type, boost::false_type>::type
|
||||
: 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>
|
||||
{};
|
||||
|
||||
} // namespace optional_detail
|
||||
@@ -967,7 +1031,7 @@ class optional
|
||||
// Can throw if T::T(T&&) does
|
||||
|
||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS
|
||||
optional ( optional && rhs ) = default;
|
||||
optional ( optional && ) = default;
|
||||
#else
|
||||
optional ( optional && rhs )
|
||||
BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value)
|
||||
@@ -989,7 +1053,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_assign_candidate<T, Expr>, optional&>::type
|
||||
operator= ( Expr&& expr )
|
||||
{
|
||||
this->assign_expr(boost::forward<Expr>(expr),boost::addressof(expr));
|
||||
@@ -1581,6 +1645,7 @@ 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.
|
||||
@@ -1593,6 +1658,7 @@ 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>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#ifndef BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
|
||||
#define BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
|
||||
|
||||
#ifndef BOOST_NO_IOSTREAM
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
@@ -31,7 +32,7 @@ operator<<(std::basic_ostream<CharType, CharTrait>& out, none_t)
|
||||
{
|
||||
out << "--";
|
||||
}
|
||||
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -90,5 +91,5 @@ operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_NO_IOSTREAM
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user