diff options
author | thegeorg <thegeorg@yandex-team.com> | 2022-08-08 10:51:28 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2022-08-08 10:51:28 +0300 |
commit | e3f540d7a6f17c12a273c2328054d4510282e58e (patch) | |
tree | 6a1e735fc7c370b0e62230e7603e5070fed735d6 | |
parent | 596c9c395ad186f94d8fc7ad759d269aa81e847b (diff) | |
download | ydb-e3f540d7a6f17c12a273c2328054d4510282e58e.tar.gz |
Update contrib/restricted/boost/smart_ptr to 1.79.0
75 files changed, 3091 insertions, 1219 deletions
diff --git a/contrib/restricted/boost/core/include/boost/core/alloc_construct.hpp b/contrib/restricted/boost/core/include/boost/core/alloc_construct.hpp new file mode 100644 index 0000000000..e390730a08 --- /dev/null +++ b/contrib/restricted/boost/core/include/boost/core/alloc_construct.hpp @@ -0,0 +1,169 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_ALLOC_CONSTRUCT_HPP +#define BOOST_CORE_ALLOC_CONSTRUCT_HPP + +#include <boost/core/noinit_adaptor.hpp> + +namespace boost { + +template<class A, class T> +inline void +alloc_destroy(A& a, T* p) +{ + boost::allocator_destroy(a, p); +} + +template<class A, class T> +inline void +alloc_destroy_n(A& a, T* p, std::size_t n) +{ + while (n > 0) { + boost::allocator_destroy(a, p + --n); + } +} + +template<class A, class T> +inline void +alloc_destroy(noinit_adaptor<A>&, T* p) +{ + p->~T(); +} + +template<class A, class T> +inline void +alloc_destroy_n(noinit_adaptor<A>&, T* p, std::size_t n) +{ + while (n > 0) { + p[--n].~T(); + } +} + +namespace detail { + +template<class A, class T> +class alloc_destroyer { +public: + alloc_destroyer(A& a, T* p) BOOST_NOEXCEPT + : a_(a), + p_(p), + n_(0) { } + + ~alloc_destroyer() { + boost::alloc_destroy_n(a_, p_, n_); + } + + std::size_t& size() BOOST_NOEXCEPT { + return n_; + } + +private: + alloc_destroyer(const alloc_destroyer&); + alloc_destroyer& operator=(const alloc_destroyer&); + + A& a_; + T* p_; + std::size_t n_; +}; + +} /* detail */ + +template<class A, class T> +inline void +alloc_construct(A& a, T* p) +{ + boost::allocator_construct(a, p); +} + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +template<class A, class T, class U, class... V> +inline void +alloc_construct(A& a, T* p, U&& u, V&&... v) +{ + boost::allocator_construct(a, p, std::forward<U>(u), + std::forward<V>(v)...); +} +#else +template<class A, class T, class U> +inline void +alloc_construct(A& a, T* p, U&& u) +{ + boost::allocator_construct(a, p, std::forward<U>(u)); +} +#endif +#else +template<class A, class T, class U> +inline void +alloc_construct(A& a, T* p, const U& u) +{ + boost::allocator_construct(a, p, u); +} + +template<class A, class T, class U> +inline void +alloc_construct(A& a, T* p, U& u) +{ + boost::allocator_construct(a, p, u); +} +#endif + +template<class A, class T> +inline void +alloc_construct_n(A& a, T* p, std::size_t n) +{ + detail::alloc_destroyer<A, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; ++i) { + boost::allocator_construct(a, p + i); + } + hold.size() = 0; +} + +template<class A, class T> +inline void +alloc_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m) +{ + detail::alloc_destroyer<A, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; ++i) { + boost::allocator_construct(a, p + i, l[i % m]); + } + hold.size() = 0; +} + +template<class A, class T, class I> +inline void +alloc_construct_n(A& a, T* p, std::size_t n, I b) +{ + detail::alloc_destroyer<A, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; void(++i), void(++b)) { + boost::allocator_construct(a, p + i, *b); + } + hold.size() = 0; +} + +template<class A, class T> +inline void +alloc_construct(noinit_adaptor<A>&, T* p) +{ + ::new(static_cast<void*>(p)) T; +} + +template<class A, class T> +inline void +alloc_construct_n(noinit_adaptor<A>& a, T* p, std::size_t n) +{ + detail::alloc_destroyer<noinit_adaptor<A>, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; ++i) { + ::new(static_cast<void*>(p + i)) T; + } + hold.size() = 0; +} + +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/core/include/boost/core/allocator_access.hpp b/contrib/restricted/boost/core/include/boost/core/allocator_access.hpp new file mode 100644 index 0000000000..247ad756e9 --- /dev/null +++ b/contrib/restricted/boost/core/include/boost/core/allocator_access.hpp @@ -0,0 +1,728 @@ +/* +Copyright 2020-2021 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_ALLOCATOR_ACCESS_HPP +#define BOOST_CORE_ALLOCATOR_ACCESS_HPP + +#include <boost/config.hpp> +#include <boost/core/pointer_traits.hpp> +#include <limits> +#include <new> +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +#include <type_traits> +#endif +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#include <utility> +#endif + +#if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 40300) +#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T) +#elif defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500) +#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T) +#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) +#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T) +#elif defined(BOOST_CLANG) && !defined(__CUDACC__) +#if __has_feature(is_empty) +#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T) +#endif +#elif defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) +#define BOOST_DETAIL_ALLOC_EMPTY(T) __oracle_is_empty(T) +#elif defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600) +#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T) +#elif defined(BOOST_CODEGEARC) +#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T) +#endif + +#if defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) +_LIBCPP_SUPPRESS_DEPRECATED_PUSH +#endif +#if defined(_STL_DISABLE_DEPRECATED_WARNING) +_STL_DISABLE_DEPRECATED_WARNING +#endif +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4996) +#endif + +namespace boost { + +template<class A> +struct allocator_value_type { + typedef typename A::value_type type; +}; + +namespace detail { + +template<class A, class = void> +struct alloc_ptr { + typedef typename boost::allocator_value_type<A>::type* type; +}; + +template<class> +struct alloc_void { + typedef void type; +}; + +template<class A> +struct alloc_ptr<A, + typename alloc_void<typename A::pointer>::type> { + typedef typename A::pointer type; +}; + +} /* detail */ + +template<class A> +struct allocator_pointer { + typedef typename detail::alloc_ptr<A>::type type; +}; + +namespace detail { + +template<class A, class = void> +struct alloc_const_ptr { + typedef typename boost::pointer_traits<typename + boost::allocator_pointer<A>::type>::template rebind_to<const typename + boost::allocator_value_type<A>::type>::type type; +}; + +template<class A> +struct alloc_const_ptr<A, + typename alloc_void<typename A::const_pointer>::type> { + typedef typename A::const_pointer type; +}; + +} /* detail */ + +template<class A> +struct allocator_const_pointer { + typedef typename detail::alloc_const_ptr<A>::type type; +}; + +namespace detail { + +template<class, class> +struct alloc_to { }; + +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +template<template<class> class A, class T, class U> +struct alloc_to<A<U>, T> { + typedef A<T> type; +}; + +template<template<class, class> class A, class T, class U, class V> +struct alloc_to<A<U, V>, T> { + typedef A<T, V> type; +}; + +template<template<class, class, class> class A, class T, class U, class V1, + class V2> +struct alloc_to<A<U, V1, V2>, T> { + typedef A<T, V1, V2> type; +}; +#else +template<template<class, class...> class A, class T, class U, class... V> +struct alloc_to<A<U, V...>, T> { + typedef A<T, V...> type; +}; +#endif + +template<class A, class T, class = void> +struct alloc_rebind { + typedef typename alloc_to<A, T>::type type; +}; + +template<class A, class T> +struct alloc_rebind<A, T, + typename alloc_void<typename A::template rebind<T>::other>::type> { + typedef typename A::template rebind<T>::other type; +}; + +} /* detail */ + +template<class A, class T> +struct allocator_rebind { + typedef typename detail::alloc_rebind<A, T>::type type; +}; + +namespace detail { + +template<class A, class = void> +struct alloc_void_ptr { + typedef typename boost::pointer_traits<typename + boost::allocator_pointer<A>::type>::template + rebind_to<void>::type type; +}; + +template<class A> +struct alloc_void_ptr<A, + typename alloc_void<typename A::void_pointer>::type> { + typedef typename A::void_pointer type; +}; + +} /* detail */ + +template<class A> +struct allocator_void_pointer { + typedef typename detail::alloc_void_ptr<A>::type type; +}; + +namespace detail { + +template<class A, class = void> +struct alloc_const_void_ptr { + typedef typename boost::pointer_traits<typename + boost::allocator_pointer<A>::type>::template + rebind_to<const void>::type type; +}; + +template<class A> +struct alloc_const_void_ptr<A, + typename alloc_void<typename A::const_void_pointer>::type> { + typedef typename A::const_void_pointer type; +}; + +} /* detail */ + +template<class A> +struct allocator_const_void_pointer { + typedef typename detail::alloc_const_void_ptr<A>::type type; +}; + +namespace detail { + +template<class A, class = void> +struct alloc_diff_type { + typedef typename boost::pointer_traits<typename + boost::allocator_pointer<A>::type>::difference_type type; +}; + +template<class A> +struct alloc_diff_type<A, + typename alloc_void<typename A::difference_type>::type> { + typedef typename A::difference_type type; +}; + +} /* detail */ + +template<class A> +struct allocator_difference_type { + typedef typename detail::alloc_diff_type<A>::type type; +}; + +namespace detail { + +#if defined(BOOST_NO_CXX11_ALLOCATOR) +template<class A, class = void> +struct alloc_size_type { + typedef std::size_t type; +}; +#else +template<class A, class = void> +struct alloc_size_type { + typedef typename std::make_unsigned<typename + boost::allocator_difference_type<A>::type>::type type; +}; +#endif + +template<class A> +struct alloc_size_type<A, + typename alloc_void<typename A::size_type>::type> { + typedef typename A::size_type type; +}; + +} /* detail */ + +template<class A> +struct allocator_size_type { + typedef typename detail::alloc_size_type<A>::type type; +}; + +namespace detail { + +#if defined(BOOST_NO_CXX11_ALLOCATOR) +template<bool V> +struct alloc_bool { + typedef bool value_type; + typedef alloc_bool type; + + static const bool value = V; + + operator bool() const BOOST_NOEXCEPT { + return V; + } + + bool operator()() const BOOST_NOEXCEPT { + return V; + } +}; + +template<bool V> +const bool alloc_bool<V>::value; + +typedef alloc_bool<false> alloc_false; +#else +typedef std::false_type alloc_false; +#endif + +template<class A, class = void> +struct alloc_pocca { + typedef alloc_false type; +}; + +template<class A> +struct alloc_pocca<A, + typename alloc_void<typename + A::propagate_on_container_copy_assignment>::type> { + typedef typename A::propagate_on_container_copy_assignment type; +}; + +} /* detail */ + +template<class A, class = void> +struct allocator_propagate_on_container_copy_assignment { + typedef typename detail::alloc_pocca<A>::type type; +}; + +namespace detail { + +template<class A, class = void> +struct alloc_pocma { + typedef alloc_false type; +}; + +template<class A> +struct alloc_pocma<A, + typename alloc_void<typename + A::propagate_on_container_move_assignment>::type> { + typedef typename A::propagate_on_container_move_assignment type; +}; + +} /* detail */ + +template<class A> +struct allocator_propagate_on_container_move_assignment { + typedef typename detail::alloc_pocma<A>::type type; +}; + +namespace detail { + +template<class A, class = void> +struct alloc_pocs { + typedef alloc_false type; +}; + +template<class A> +struct alloc_pocs<A, + typename alloc_void<typename A::propagate_on_container_swap>::type> { + typedef typename A::propagate_on_container_swap type; +}; + +} /* detail */ + +template<class A> +struct allocator_propagate_on_container_swap { + typedef typename detail::alloc_pocs<A>::type type; +}; + +namespace detail { + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +template<class A, class = void> +struct alloc_equal { + typedef typename std::is_empty<A>::type type; +}; +#elif defined(BOOST_DETAIL_ALLOC_EMPTY) +template<class A, class = void> +struct alloc_equal { + typedef alloc_bool<BOOST_DETAIL_ALLOC_EMPTY(A)> type; +}; +#else +template<class A, class = void> +struct alloc_equal { + typedef alloc_false type; +}; +#endif + +template<class A> +struct alloc_equal<A, + typename alloc_void<typename A::is_always_equal>::type> { + typedef typename A::is_always_equal type; +}; + +} /* detail */ + +template<class A> +struct allocator_is_always_equal { + typedef typename detail::alloc_equal<A>::type type; +}; + +template<class A> +inline typename allocator_pointer<A>::type +allocator_allocate(A& a, typename allocator_size_type<A>::type n) +{ + return a.allocate(n); +} + +template<class A> +inline void +allocator_deallocate(A& a, typename allocator_pointer<A>::type p, + typename allocator_size_type<A>::type n) +{ + a.deallocate(p, n); +} + +#if defined(BOOST_NO_CXX11_ALLOCATOR) +template<class A> +inline typename allocator_pointer<A>::type +allocator_allocate(A& a, typename allocator_size_type<A>::type n, + typename allocator_const_void_pointer<A>::type h) +{ + return a.allocate(n, h); +} +#else +namespace detail { + +template<class> +struct alloc_no { + char x, y; +}; + +template<class A> +class alloc_has_allocate { + template<class O> + static auto check(int) + -> alloc_no<decltype(std::declval<O&>().allocate(std::declval<typename + boost::allocator_size_type<A>::type>(), std::declval<typename + boost::allocator_const_void_pointer<A>::type>()))>; + + template<class> + static char check(long); + +public: + BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1; +}; + +} /* detail */ + +template<class A> +inline typename std::enable_if<detail::alloc_has_allocate<A>::value, + typename allocator_pointer<A>::type>::type +allocator_allocate(A& a, typename allocator_size_type<A>::type n, + typename allocator_const_void_pointer<A>::type h) +{ + return a.allocate(n, h); +} + +template<class A> +inline typename std::enable_if<!detail::alloc_has_allocate<A>::value, + typename allocator_pointer<A>::type>::type +allocator_allocate(A& a, typename allocator_size_type<A>::type n, + typename allocator_const_void_pointer<A>::type) +{ + return a.allocate(n); +} +#endif + +#if defined(BOOST_NO_CXX11_ALLOCATOR) +template<class A, class T> +inline void +allocator_construct(A&, T* p) +{ + ::new((void*)p) T(); +} + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +template<class A, class T, class V, class... Args> +inline void +allocator_construct(A&, T* p, V&& v, Args&&... args) +{ + ::new((void*)p) T(std::forward<V>(v), std::forward<Args>(args)...); +} +#else +template<class A, class T, class V> +inline void +allocator_construct(A&, T* p, V&& v) +{ + ::new((void*)p) T(std::forward<V>(v)); +} +#endif +#else +template<class A, class T, class V> +inline void +allocator_construct(A&, T* p, const V& v) +{ + ::new((void*)p) T(v); +} + +template<class A, class T, class V> +inline void +allocator_construct(A&, T* p, V& v) +{ + ::new((void*)p) T(v); +} +#endif +#else +namespace detail { + +template<class A, class T, class... Args> +class alloc_has_construct { + template<class O> + static auto check(int) + -> alloc_no<decltype(std::declval<O&>().construct(std::declval<T*>(), + std::declval<Args&&>()...))>; + + template<class> + static char check(long); + +public: + BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1; +}; + +} /* detail */ + +template<class A, class T, class... Args> +inline typename std::enable_if<detail::alloc_has_construct<A, T, + Args...>::value>::type +allocator_construct(A& a, T* p, Args&&... args) +{ + a.construct(p, std::forward<Args>(args)...); +} + +template<class A, class T, class... Args> +inline typename std::enable_if<!detail::alloc_has_construct<A, T, + Args...>::value>::type +allocator_construct(A&, T* p, Args&&... args) +{ + ::new((void*)p) T(std::forward<Args>(args)...); +} +#endif + +#if defined(BOOST_NO_CXX11_ALLOCATOR) +template<class A, class T> +inline void +allocator_destroy(A&, T* p) +{ + p->~T(); + (void)p; +} +#else +namespace detail { + +template<class A, class T> +class alloc_has_destroy { + template<class O> + static auto check(int) + -> alloc_no<decltype(std::declval<O&>().destroy(std::declval<T*>()))>; + + template<class> + static char check(long); + +public: + BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1; +}; + +} /* detail */ + +template<class A, class T> +inline typename std::enable_if<detail::alloc_has_destroy<A, T>::value>::type +allocator_destroy(A& a, T* p) +{ + a.destroy(p); +} + +template<class A, class T> +inline typename std::enable_if<!detail::alloc_has_destroy<A, T>::value>::type +allocator_destroy(A&, T* p) +{ + p->~T(); + (void)p; +} +#endif + +namespace detail { + +#if defined(BOOST_NO_CXX11_ALLOCATOR) +template<class T, T> +struct alloc_no { + char x, y; +}; + +template<class A> +class alloc_has_max_size { + template<class O> + static alloc_no<typename boost::allocator_size_type<O>::type(O::*)(), + &O::max_size> check(int); + + template<class O> + static alloc_no<typename boost::allocator_size_type<O>::type(O::*)() const, + &O::max_size> check(int); + + template<class O> + static alloc_no<typename boost::allocator_size_type<O>::type(*)(), + &O::max_size> check(int); + + template<class> + static char check(long); + +public: + BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1; +}; +#else +template<class A> +class alloc_has_max_size { + template<class O> + static auto check(int) + -> alloc_no<decltype(std::declval<const O&>().max_size())>; + + template<class> + static char check(long); + +public: + BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1; +}; +#endif + +template<bool, class> +struct alloc_if { }; + +template<class T> +struct alloc_if<true, T> { + typedef T type; +}; + +} /* detail */ + +template<class A> +inline typename detail::alloc_if<detail::alloc_has_max_size<A>::value, + typename allocator_size_type<A>::type>::type +allocator_max_size(const A& a) BOOST_NOEXCEPT +{ + return a.max_size(); +} + +template<class A> +inline typename detail::alloc_if<!detail::alloc_has_max_size<A>::value, + typename allocator_size_type<A>::type>::type +allocator_max_size(const A&) BOOST_NOEXCEPT +{ + return (std::numeric_limits<typename + allocator_size_type<A>::type>::max)() / + sizeof(typename allocator_value_type<A>::type); +} + +namespace detail { + +#if defined(BOOST_NO_CXX11_ALLOCATOR) +template<class A> +class alloc_has_soccc { + template<class O> + static alloc_no<O(O::*)(), &O::select_on_container_copy_construction> + check(int); + + template<class O> + static alloc_no<O(O::*)() const, &O::select_on_container_copy_construction> + check(int); + + template<class O> + static alloc_no<O(*)(), &O::select_on_container_copy_construction> + check(int); + + template<class> + static char check(long); + +public: + BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1; +}; +#else +template<class A> +class alloc_has_soccc { + template<class O> + static auto check(int) -> alloc_no<decltype(std::declval<const + O&>().select_on_container_copy_construction())>; + + template<class> + static char check(long); + +public: + BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1; +}; +#endif + +} /* detail */ + +template<class A> +inline typename detail::alloc_if<detail::alloc_has_soccc<A>::value, A>::type +allocator_select_on_container_copy_construction(const A& a) +{ + return a.select_on_container_copy_construction(); +} + +template<class A> +inline typename detail::alloc_if<!detail::alloc_has_soccc<A>::value, A>::type +allocator_select_on_container_copy_construction(const A& a) +{ + return a; +} + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) +template<class A> +using allocator_value_type_t = typename allocator_value_type<A>::type; + +template<class A> +using allocator_pointer_t = typename allocator_pointer<A>::type; + +template<class A> +using allocator_const_pointer_t = typename allocator_const_pointer<A>::type; + +template<class A> +using allocator_void_pointer_t = typename allocator_void_pointer<A>::type; + +template<class A> +using allocator_const_void_pointer_t = + typename allocator_const_void_pointer<A>::type; + +template<class A> +using allocator_difference_type_t = + typename allocator_difference_type<A>::type; + +template<class A> +using allocator_size_type_t = typename allocator_size_type<A>::type; + +template<class A> +using allocator_propagate_on_container_copy_assignment_t = + typename allocator_propagate_on_container_copy_assignment<A>::type; + +template<class A> +using allocator_propagate_on_container_move_assignment_t = + typename allocator_propagate_on_container_move_assignment<A>::type; + +template<class A> +using allocator_propagate_on_container_swap_t = + typename allocator_propagate_on_container_swap<A>::type; + +template<class A> +using allocator_is_always_equal_t = + typename allocator_is_always_equal<A>::type; + +template<class A, class T> +using allocator_rebind_t = typename allocator_rebind<A, T>::type; +#endif + +} /* boost */ + +#if defined(_LIBCPP_SUPPRESS_DEPRECATED_POP) +_LIBCPP_SUPPRESS_DEPRECATED_POP +#endif +#if defined(_STL_RESTORE_DEPRECATED_WARNING) +_STL_RESTORE_DEPRECATED_WARNING +#endif +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +#endif diff --git a/contrib/restricted/boost/core/include/boost/core/default_allocator.hpp b/contrib/restricted/boost/core/include/boost/core/default_allocator.hpp new file mode 100644 index 0000000000..91d3bbcbb0 --- /dev/null +++ b/contrib/restricted/boost/core/include/boost/core/default_allocator.hpp @@ -0,0 +1,158 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_DEFAULT_ALLOCATOR_HPP +#define BOOST_CORE_DEFAULT_ALLOCATOR_HPP + +#include <boost/config.hpp> +#include <new> + +namespace boost { + +#if defined(BOOST_NO_EXCEPTIONS) +BOOST_NORETURN void throw_exception(const std::exception&); +#endif + +namespace default_ { + +template<bool V> +struct bool_constant { + typedef bool value_type; + typedef bool_constant type; + + static const bool value = V; + + operator bool() const BOOST_NOEXCEPT { + return V; + } + + bool operator()() const BOOST_NOEXCEPT { + return V; + } +}; + +template<bool V> +const bool bool_constant<V>::value; + +template<class T> +struct add_reference { + typedef T& type; +}; + +template<> +struct add_reference<void> { + typedef void type; +}; + +template<> +struct add_reference<const void> { + typedef const void type; +}; + +template<class T> +struct default_allocator { + typedef T value_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef typename add_reference<T>::type reference; + typedef typename add_reference<const T>::type const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef bool_constant<true> propagate_on_container_move_assignment; + typedef bool_constant<true> is_always_equal; + + template<class U> + struct rebind { + typedef default_allocator<U> other; + }; + +#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) + default_allocator() = default; +#else + BOOST_CONSTEXPR default_allocator() BOOST_NOEXCEPT { } +#endif + + template<class U> + BOOST_CONSTEXPR default_allocator(const default_allocator<U>&) + BOOST_NOEXCEPT { } + + BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT { + return static_cast<std::size_t>(-1) / (2 < sizeof(T) ? sizeof(T) : 2); + } + +#if !defined(BOOST_NO_EXCEPTIONS) + T* allocate(std::size_t n) { + if (n > max_size()) { + throw std::bad_alloc(); + } + return static_cast<T*>(::operator new(sizeof(T) * n)); + } + + void deallocate(T* p, std::size_t) { + ::operator delete(p); + } +#else + T* allocate(std::size_t n) { + if (n > max_size()) { + boost::throw_exception(std::bad_alloc()); + } + void* p = ::operator new(sizeof(T) * n, std::nothrow); + if (!p) { + boost::throw_exception(std::bad_alloc()); + } + return static_cast<T*>(p); + } + + void deallocate(T* p, std::size_t) { + ::operator delete(p, std::nothrow); + } +#endif + +#if defined(BOOST_NO_CXX11_ALLOCATOR) + T* allocate(std::size_t n, const void*) { + return allocate(n); + } +#endif + +#if (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 60000) || \ + defined(BOOST_NO_CXX11_ALLOCATOR) + template<class U, class V> + void construct(U* p, const V& v) { + ::new(p) U(v); + } + + template<class U> + void destroy(U* p) { + p->~U(); + (void)p; + } +#endif +}; + +template<class T, class U> +BOOST_CONSTEXPR inline bool +operator==(const default_allocator<T>&, + const default_allocator<U>&) BOOST_NOEXCEPT +{ + return true; +} + +template<class T, class U> +BOOST_CONSTEXPR inline bool +operator!=(const default_allocator<T>&, + const default_allocator<U>&) BOOST_NOEXCEPT +{ + return false; +} + +} /* default_ */ + +using default_::default_allocator; + +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/core/include/boost/core/first_scalar.hpp b/contrib/restricted/boost/core/include/boost/core/first_scalar.hpp new file mode 100644 index 0000000000..5373542e02 --- /dev/null +++ b/contrib/restricted/boost/core/include/boost/core/first_scalar.hpp @@ -0,0 +1,45 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_FIRST_SCALAR_HPP +#define BOOST_CORE_FIRST_SCALAR_HPP + +#include <boost/config.hpp> +#include <cstddef> + +namespace boost { +namespace detail { + +template<class T> +struct make_scalar { + typedef T type; +}; + +template<class T, std::size_t N> +struct make_scalar<T[N]> { + typedef typename make_scalar<T>::type type; +}; + +} /* detail */ + +template<class T> +BOOST_CONSTEXPR inline T* +first_scalar(T* p) BOOST_NOEXCEPT +{ + return p; +} + +template<class T, std::size_t N> +BOOST_CONSTEXPR inline typename detail::make_scalar<T>::type* +first_scalar(T (*p)[N]) BOOST_NOEXCEPT +{ + return boost::first_scalar(&(*p)[0]); +} + +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/core/include/boost/core/noinit_adaptor.hpp b/contrib/restricted/boost/core/include/boost/core/noinit_adaptor.hpp new file mode 100644 index 0000000000..962b6e42e7 --- /dev/null +++ b/contrib/restricted/boost/core/include/boost/core/noinit_adaptor.hpp @@ -0,0 +1,88 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_NOINIT_ADAPTOR_HPP +#define BOOST_CORE_NOINIT_ADAPTOR_HPP + +#include <boost/core/allocator_access.hpp> + +namespace boost { + +template<class A> +struct noinit_adaptor + : A { + template<class U> + struct rebind { + typedef noinit_adaptor<typename allocator_rebind<A, U>::type> other; + }; + + noinit_adaptor() + : A() { } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template<class U> + noinit_adaptor(U&& u) BOOST_NOEXCEPT + : A(std::forward<U>(u)) { } +#else + template<class U> + noinit_adaptor(const U& u) BOOST_NOEXCEPT + : A(u) { } + + template<class U> + noinit_adaptor(U& u) BOOST_NOEXCEPT + : A(u) { } +#endif + + template<class U> + noinit_adaptor(const noinit_adaptor<U>& u) BOOST_NOEXCEPT + : A(static_cast<const A&>(u)) { } + + template<class U> + void construct(U* p) { + ::new((void*)p) U; + } + +#if defined(BOOST_NO_CXX11_ALLOCATOR) + template<class U, class V> + void construct(U* p, const V& v) { + ::new((void*)p) U(v); + } +#endif + + template<class U> + void destroy(U* p) { + p->~U(); + (void)p; + } +}; + +template<class T, class U> +inline bool +operator==(const noinit_adaptor<T>& lhs, + const noinit_adaptor<U>& rhs) BOOST_NOEXCEPT +{ + return static_cast<const T&>(lhs) == static_cast<const U&>(rhs); +} + +template<class T, class U> +inline bool +operator!=(const noinit_adaptor<T>& lhs, + const noinit_adaptor<U>& rhs) BOOST_NOEXCEPT +{ + return !(lhs == rhs); +} + +template<class A> +inline noinit_adaptor<A> +noinit_adapt(const A& a) BOOST_NOEXCEPT +{ + return noinit_adaptor<A>(a); +} + +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/allocate_shared_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/allocate_shared_array.hpp index 340688146c..5f00d91e18 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/allocate_shared_array.hpp @@ -1,5 +1,5 @@ /* -Copyright 2012-2017 Glen Joseph Fernandes +Copyright 2012-2019 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. @@ -8,88 +8,26 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP #define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP +#include <boost/core/allocator_access.hpp> +#include <boost/core/alloc_construct.hpp> +#include <boost/core/first_scalar.hpp> #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/type_traits/alignment_of.hpp> -#include <boost/type_traits/has_trivial_assign.hpp> -#include <boost/type_traits/has_trivial_constructor.hpp> -#include <boost/type_traits/has_trivial_destructor.hpp> +#include <boost/type_traits/enable_if.hpp> +#include <boost/type_traits/extent.hpp> +#include <boost/type_traits/is_bounded_array.hpp> +#include <boost/type_traits/is_unbounded_array.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/remove_extent.hpp> #include <boost/type_traits/type_with_alignment.hpp> namespace boost { namespace detail { -template<class> -struct sp_if_array { }; - -template<class T> -struct sp_if_array<T[]> { - typedef boost::shared_ptr<T[]> type; -}; - -template<class> -struct sp_if_size_array { }; - -template<class T, std::size_t N> -struct sp_if_size_array<T[N]> { - typedef boost::shared_ptr<T[N]> type; -}; - -template<class> -struct sp_array_element { }; - -template<class T> -struct sp_array_element<T[]> { - typedef T type; -}; - -template<class T, std::size_t N> -struct sp_array_element<T[N]> { - typedef T type; -}; - -template<class T> -struct sp_array_scalar { - typedef T type; -}; - -template<class T, std::size_t N> -struct sp_array_scalar<T[N]> { - typedef typename sp_array_scalar<T>::type type; -}; - -template<class T, std::size_t N> -struct sp_array_scalar<const T[N]> { - typedef typename sp_array_scalar<T>::type type; -}; - -template<class T, std::size_t N> -struct sp_array_scalar<volatile T[N]> { - typedef typename sp_array_scalar<T>::type type; -}; - -template<class T, std::size_t N> -struct sp_array_scalar<const volatile T[N]> { - typedef typename sp_array_scalar<T>::type type; -}; - -template<class T> -struct sp_array_scalar<T[]> { - typedef typename sp_array_scalar<T>::type type; -}; - -template<class T> -struct sp_array_scalar<const T[]> { - typedef typename sp_array_scalar<T>::type type; -}; - -template<class T> -struct sp_array_scalar<volatile T[]> { - typedef typename sp_array_scalar<T>::type type; -}; - template<class T> -struct sp_array_scalar<const volatile T[]> { - typedef typename sp_array_scalar<T>::type type; +struct sp_array_element { + typedef typename boost::remove_cv<typename + boost::remove_extent<T>::type>::type type; }; template<class T> @@ -120,18 +58,6 @@ struct sp_align_up { }; }; -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template<class A, class T> -struct sp_bind_allocator { - typedef typename std::allocator_traits<A>::template rebind_alloc<T> type; -}; -#else -template<class A, class T> -struct sp_bind_allocator { - typedef typename A::template rebind<T>::other type; -}; -#endif - template<class T> BOOST_CONSTEXPR inline std::size_t sp_objects(std::size_t size) BOOST_SP_NOEXCEPT @@ -139,214 +65,6 @@ sp_objects(std::size_t size) BOOST_SP_NOEXCEPT return (size + sizeof(T) - 1) / sizeof(T); } -template<bool, class = void> -struct sp_enable { }; - -template<class T> -struct sp_enable<true, T> { - typedef T type; -}; - -template<bool E, class A, class T> -inline typename sp_enable<!E && boost::has_trivial_destructor<T>::value>::type -sp_array_destroy(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } - -template<bool E, class A, class T> -inline typename sp_enable<!E && - !boost::has_trivial_destructor<T>::value>::type -sp_array_destroy(A&, T* start, std::size_t size) -{ - while (size > 0) { - start[--size].~T(); - } -} - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template<bool E, class A, class T> -inline typename sp_enable<E>::type -sp_array_destroy(A& allocator, T* start, std::size_t size) -{ - while (size > 0) { - std::allocator_traits<A>::destroy(allocator, start + --size); - } -} -#endif - -template<bool E, class A, class T> -inline typename sp_enable<!E && - boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value>::type -sp_array_construct(A&, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - start[i] = T(); - } -} - -template<bool E, class A, class T> -inline typename sp_enable<!E && - boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value>::type -sp_array_construct(A&, T* start, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - start[i] = list[i % count]; - } -} - -#if !defined(BOOST_NO_EXCEPTIONS) -template<bool E, class A, class T> -inline typename sp_enable<!E && - !(boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value)>::type -sp_array_construct(A& none, T* start, std::size_t size) -{ - std::size_t i = 0; - try { - for (; i < size; ++i) { - ::new(static_cast<void*>(start + i)) T(); - } - } catch (...) { - sp_array_destroy<E>(none, start, i); - throw; - } -} - -template<bool E, class A, class T> -inline typename sp_enable<!E && - !(boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value)>::type -sp_array_construct(A& none, T* start, std::size_t size, const T* list, - std::size_t count) -{ - std::size_t i = 0; - try { - for (; i < size; ++i) { - ::new(static_cast<void*>(start + i)) T(list[i % count]); - } - } catch (...) { - sp_array_destroy<E>(none, start, i); - throw; - } -} -#else -template<bool E, class A, class T> -inline typename sp_enable<!E && - !(boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value)>::type -sp_array_construct(A&, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - ::new(static_cast<void*>(start + i)) T(); - } -} - -template<bool E, class A, class T> -inline typename sp_enable<!E && - !(boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value)>::type -sp_array_construct(A&, T* start, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - ::new(static_cast<void*>(start + i)) T(list[i % count]); - } -} -#endif - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -#if !defined(BOOST_NO_EXCEPTIONS) -template<bool E, class A, class T> -inline typename sp_enable<E>::type -sp_array_construct(A& allocator, T* start, std::size_t size) -{ - std::size_t i = 0; - try { - for (i = 0; i < size; ++i) { - std::allocator_traits<A>::construct(allocator, start + i); - } - } catch (...) { - sp_array_destroy<E>(allocator, start, i); - throw; - } -} - -template<bool E, class A, class T> -inline typename sp_enable<E>::type -sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, - std::size_t count) -{ - std::size_t i = 0; - try { - for (i = 0; i < size; ++i) { - std::allocator_traits<A>::construct(allocator, start + i, - list[i % count]); - } - } catch (...) { - sp_array_destroy<E>(allocator, start, i); - throw; - } -} -#else -template<bool E, class A, class T> -inline typename sp_enable<E>::type -sp_array_construct(A& allocator, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - std::allocator_traits<A>::construct(allocator, start + i); - } -} - -template<bool E, class A, class T> -inline typename sp_enable<E>::type -sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - std::allocator_traits<A>::construct(allocator, start + i, - list[i % count]); - } -} -#endif -#endif - -template<class A, class T> -inline typename sp_enable<boost::has_trivial_constructor<T>::value>::type -sp_array_default(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } - -#if !defined(BOOST_NO_EXCEPTIONS) -template<class A, class T> -inline typename sp_enable<!boost::has_trivial_constructor<T>::value>::type -sp_array_default(A& none, T* start, std::size_t size) -{ - std::size_t i = 0; - try { - for (; i < size; ++i) { - ::new(static_cast<void*>(start + i)) T; - } - } catch (...) { - sp_array_destroy<false>(none, start, i); - throw; - } -} -#else -template<bool E, class A, class T> -inline typename sp_enable<!boost::has_trivial_constructor<T>::value>::type -sp_array_default(A&, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - ::new(static_cast<void*>(start + i)) T; - } -} -#endif - template<class A> class sp_array_state { public: @@ -391,29 +109,6 @@ private: A allocator_; }; -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template<class A> -struct sp_use_construct { - enum { - value = true - }; -}; - -template<class T> -struct sp_use_construct<std::allocator<T> > { - enum { - value = false - }; -}; -#else -template<class> -struct sp_use_construct { - enum { - value = false - }; -}; -#endif - template<class T, class U> struct sp_array_alignment { enum { @@ -429,39 +124,32 @@ struct sp_array_offset { }; }; -template<class T, class U> -struct sp_array_storage { - enum { - value = sp_array_alignment<T, U>::value - }; - typedef typename boost::type_with_alignment<value>::type type; -}; - -template<class T, class U> +template<class U, class T> inline U* -sp_array_start(void* base) BOOST_SP_NOEXCEPT +sp_array_start(T* base) BOOST_SP_NOEXCEPT { enum { size = sp_array_offset<T, U>::value }; - return reinterpret_cast<U*>(static_cast<char*>(base) + size); + return reinterpret_cast<U*>(reinterpret_cast<char*>(base) + size); } template<class A, class T> class sp_array_creator { - typedef typename A::value_type scalar; + typedef typename A::value_type element; enum { - offset = sp_array_offset<T, scalar>::value + offset = sp_array_offset<T, element>::value }; - typedef typename sp_array_storage<T, scalar>::type type; + typedef typename boost::type_with_alignment<sp_array_alignment<T, + element>::value>::type type; public: template<class U> sp_array_creator(const U& other, std::size_t size) BOOST_SP_NOEXCEPT : other_(other), - size_(sp_objects<type>(offset + sizeof(scalar) * size)) { } + size_(sp_objects<type>(offset + sizeof(element) * size)) { } T* create() { return reinterpret_cast<T*>(other_.allocate(size_)); @@ -472,14 +160,12 @@ public: } private: - typename sp_bind_allocator<A, type>::type other_; + typename boost::allocator_rebind<A, type>::type other_; std::size_t size_; }; -struct sp_default { }; - -template<class T, bool E = sp_use_construct<T>::value> -class sp_array_base +template<class T> +class BOOST_SYMBOL_VISIBLE sp_array_base : public sp_counted_base { typedef typename T::type allocator; @@ -487,50 +173,51 @@ public: typedef typename allocator::value_type type; template<class A> - sp_array_base(const A& other, std::size_t size, type* start) - : state_(other, size) { - sp_array_construct<E>(state_.allocator(), start, state_.size()); - } - - template<class A> - sp_array_base(const A& other, std::size_t size, const type* list, - std::size_t count, type* start) + sp_array_base(const A& other, type* start, std::size_t size) : state_(other, size) { - sp_array_construct<E>(state_.allocator(), start, state_.size(), list, - count); + boost::alloc_construct_n(state_.allocator(), + boost::first_scalar(start), + state_.size() * sp_array_count<type>::value); } - template<class A> - sp_array_base(sp_default, const A& other, std::size_t size, type* start) + template<class A, class U> + sp_array_base(const A& other, type* start, std::size_t size, const U& list) : state_(other, size) { - sp_array_default(state_.allocator(), start, state_.size()); + enum { + count = sp_array_count<type>::value + }; + boost::alloc_construct_n(state_.allocator(), + boost::first_scalar(start), state_.size() * count, + boost::first_scalar(&list), count); } T& state() BOOST_SP_NOEXCEPT { return state_; } - virtual void dispose() { - sp_array_destroy<E>(state_.allocator(), - sp_array_start<sp_array_base, type>(this), state_.size()); + void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { + boost::alloc_destroy_n(state_.allocator(), + boost::first_scalar(sp_array_start<type>(this)), + state_.size() * sp_array_count<type>::value); } - virtual void destroy() { + void destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { sp_array_creator<allocator, sp_array_base> other(state_.allocator(), state_.size()); this->~sp_array_base(); other.destroy(this); } - virtual void* get_deleter(const sp_typeinfo&) { + void* get_deleter(const sp_typeinfo_&) BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return 0; } - virtual void* get_local_deleter(const sp_typeinfo&) { + void* get_local_deleter(const sp_typeinfo_&) + BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return 0; } - virtual void* get_untyped_deleter() { + void* get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return 0; } @@ -552,11 +239,11 @@ public: } } - T* get() const { + T* get() const BOOST_SP_NOEXCEPT { return result_; } - void release() { + void release() BOOST_SP_NOEXCEPT { result_ = 0; } @@ -571,131 +258,93 @@ private: } /* detail */ template<class T, class A> -inline typename detail::sp_if_array<T>::type +inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type allocate_shared(const A& allocator, std::size_t count) { - typedef typename detail::sp_array_element<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; + typedef typename detail::sp_array_element<T>::type element; + typedef typename allocator_rebind<A, element>::type other; typedef detail::sp_array_state<other> state; typedef detail::sp_array_base<state> base; - std::size_t size = count * detail::sp_array_count<type>::value; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(allocator, size, start); + detail::sp_array_result<other, base> result(allocator, count); + base* node = result.get(); + element* start = detail::sp_array_start<element>(node); + ::new(static_cast<void*>(node)) base(allocator, start, count); result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return shared_ptr<T>(detail::sp_internal_constructor_tag(), start, + detail::shared_count(static_cast<detail::sp_counted_base*>(node))); } template<class T, class A> -inline typename detail::sp_if_size_array<T>::type +inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type allocate_shared(const A& allocator) { enum { - size = detail::sp_array_count<T>::value + count = extent<T>::value }; - typedef typename detail::sp_array_element<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; - typedef detail::sp_size_array_state<other, size> state; + typedef typename detail::sp_array_element<T>::type element; + typedef typename allocator_rebind<A, element>::type other; + typedef detail::sp_size_array_state<other, extent<T>::value> state; typedef detail::sp_array_base<state> base; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(allocator, size, start); + detail::sp_array_result<other, base> result(allocator, count); + base* node = result.get(); + element* start = detail::sp_array_start<element>(node); + ::new(static_cast<void*>(node)) base(allocator, start, count); result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return shared_ptr<T>(detail::sp_internal_constructor_tag(), start, + detail::shared_count(static_cast<detail::sp_counted_base*>(node))); } template<class T, class A> -inline typename detail::sp_if_array<T>::type +inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type allocate_shared(const A& allocator, std::size_t count, - const typename detail::sp_array_element<T>::type& value) + const typename remove_extent<T>::type& value) { - typedef typename detail::sp_array_element<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; + typedef typename detail::sp_array_element<T>::type element; + typedef typename allocator_rebind<A, element>::type other; typedef detail::sp_array_state<other> state; typedef detail::sp_array_base<state> base; - std::size_t size = count * detail::sp_array_count<type>::value; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(allocator, size, - reinterpret_cast<const scalar*>(&value), - detail::sp_array_count<type>::value, start); + detail::sp_array_result<other, base> result(allocator, count); + base* node = result.get(); + element* start = detail::sp_array_start<element>(node); + ::new(static_cast<void*>(node)) base(allocator, start, count, value); result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return shared_ptr<T>(detail::sp_internal_constructor_tag(), start, + detail::shared_count(static_cast<detail::sp_counted_base*>(node))); } template<class T, class A> -inline typename detail::sp_if_size_array<T>::type +inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type allocate_shared(const A& allocator, - const typename detail::sp_array_element<T>::type& value) + const typename remove_extent<T>::type& value) { enum { - size = detail::sp_array_count<T>::value + count = extent<T>::value }; - typedef typename detail::sp_array_element<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; - typedef detail::sp_size_array_state<other, size> state; + typedef typename detail::sp_array_element<T>::type element; + typedef typename allocator_rebind<A, element>::type other; + typedef detail::sp_size_array_state<other, extent<T>::value> state; typedef detail::sp_array_base<state> base; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(allocator, size, - reinterpret_cast<const scalar*>(&value), - detail::sp_array_count<type>::value, start); + detail::sp_array_result<other, base> result(allocator, count); + base* node = result.get(); + element* start = detail::sp_array_start<element>(node); + ::new(static_cast<void*>(node)) base(allocator, start, count, value); result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return shared_ptr<T>(detail::sp_internal_constructor_tag(), start, + detail::shared_count(static_cast<detail::sp_counted_base*>(node))); } template<class T, class A> -inline typename detail::sp_if_array<T>::type +inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type allocate_shared_noinit(const A& allocator, std::size_t count) { - typedef typename detail::sp_array_element<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; - typedef detail::sp_array_state<other> state; - typedef detail::sp_array_base<state, false> base; - std::size_t size = count * detail::sp_array_count<type>::value; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(detail::sp_default(), allocator, - size, start); - result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return boost::allocate_shared<T>(boost::noinit_adapt(allocator), count); } template<class T, class A> -inline typename detail::sp_if_size_array<T>::type +inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type allocate_shared_noinit(const A& allocator) { - enum { - size = detail::sp_array_count<T>::value - }; - typedef typename detail::sp_array_element<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; - typedef detail::sp_size_array_state<other, size> state; - typedef detail::sp_array_base<state, false> base; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(detail::sp_default(), allocator, - size, start); - result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return boost::allocate_shared<T>(boost::noinit_adapt(allocator)); } } /* boost */ diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/bad_weak_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/bad_weak_ptr.hpp index 0105ca4cb0..d8edd04c93 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/bad_weak_ptr.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/bad_weak_ptr.hpp @@ -20,7 +20,7 @@ #include <boost/config.hpp> #include <exception> -#ifdef __BORLANDC__ +#ifdef BOOST_BORLANDC # pragma warn -8026 // Functions with excep. spec. are not expanded inline #endif @@ -33,7 +33,7 @@ namespace boost // is compiled with -ps, the compiler issues an error. // Hence, the temporary #pragma option -pc below. -#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 +#if defined(BOOST_BORLANDC) && BOOST_BORLANDC <= 0x564 # pragma option push -pc #endif @@ -47,7 +47,7 @@ class bad_weak_ptr: public std::exception { public: - virtual char const * what() const noexcept + char const * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE { return "tr1::bad_weak_ptr"; } @@ -57,13 +57,13 @@ public: # pragma clang diagnostic pop #endif -#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 +#if defined(BOOST_BORLANDC) && BOOST_BORLANDC <= 0x564 # pragma option pop #endif } // namespace boost -#ifdef __BORLANDC__ +#ifdef BOOST_BORLANDC # pragma warn .8026 // Functions with excep. spec. are not expanded inline #endif diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count.hpp index 6e4f71aa8e..749b3f08a1 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count.hpp @@ -43,8 +43,9 @@ // Memory Ordering: acquire/release // +#include <boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp> +#include <boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp> #include <boost/config.hpp> -#include <boost/smart_ptr/detail/sp_has_sync.hpp> #if defined( BOOST_AC_DISABLE_THREADS ) # include <boost/smart_ptr/detail/atomic_count_nt.hpp> @@ -73,15 +74,18 @@ #elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) # include <boost/smart_ptr/detail/atomic_count_nt.hpp> +#elif defined( BOOST_SP_HAS_GCC_INTRINSICS ) +# include <boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp> + #elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) # include <boost/smart_ptr/detail/atomic_count_std_atomic.hpp> +#elif defined( BOOST_SP_HAS_SYNC_INTRINSICS ) +# include <boost/smart_ptr/detail/atomic_count_sync.hpp> + #elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ ) # include <boost/smart_ptr/detail/atomic_count_gcc_x86.hpp> -#elif defined( BOOST_SP_HAS_SYNC ) -# include <boost/smart_ptr/detail/atomic_count_sync.hpp> - #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # include <boost/smart_ptr/detail/atomic_count_win32.hpp> diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc.hpp index df7e32365f..f8b5621b60 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc.hpp @@ -23,6 +23,13 @@ # include <bits/atomicity.h> #endif +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using libstdc++ atomic_count") + +#endif + namespace boost { diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp new file mode 100644 index 0000000000..801a7cbf9b --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp @@ -0,0 +1,63 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_ATOMIC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_ATOMIC_HPP_INCLUDED + +// boost/detail/atomic_count_gcc_atomic.hpp +// +// atomic_count for g++ 4.7+ +// +// Copyright 2007, 2020 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/cstdint.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using __atomic atomic_count") + +#endif + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ): value_( static_cast< boost::int_least32_t >( v ) ) + { + } + + long operator++() + { + return __atomic_add_fetch( &value_, +1, __ATOMIC_ACQ_REL ); + } + + long operator--() + { + return __atomic_add_fetch( &value_, -1, __ATOMIC_ACQ_REL ); + } + + operator long() const + { + return __atomic_load_n( &value_, __ATOMIC_ACQUIRE ); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + boost::int_least32_t value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_ATOMIC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp index 5c44d7c1ef..30a73e3b12 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp @@ -13,6 +13,17 @@ // http://www.boost.org/LICENSE_1_0.txt) // +#include <boost/smart_ptr/detail/sp_obsolete.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using g++/x86 atomic_count") + +#endif + +BOOST_SP_OBSOLETE() + namespace boost { diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_nt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_nt.hpp index 3bbf138913..63b848f19d 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_nt.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_nt.hpp @@ -15,6 +15,13 @@ // http://www.boost.org/LICENSE_1_0.txt // +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using single-threaded, non-atomic atomic_count") + +#endif + namespace boost { diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_pt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_pt.hpp index f99b9108e3..69a494d045 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_pt.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_pt.hpp @@ -14,6 +14,13 @@ #include <boost/assert.hpp> #include <pthread.h> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using pthread_mutex atomic_count") + +#endif + // // The generic pthread_mutex-based implementation sometimes leads to // inefficiencies. Example: a class with two atomic_count members diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_spin.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_spin.hpp index 8e623496bf..66332e9e2b 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_spin.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_spin.hpp @@ -13,6 +13,13 @@ #include <boost/smart_ptr/detail/spinlock_pool.hpp> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using spinlock-based atomic_count") + +#endif + namespace boost { diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_std_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_std_atomic.hpp index 55b9998e52..360d26ad36 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_std_atomic.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_std_atomic.hpp @@ -16,6 +16,13 @@ #include <atomic> #include <cstdint> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using std::atomic atomic_count") + +#endif + namespace boost { @@ -26,7 +33,7 @@ class atomic_count { public: - explicit atomic_count( long v ): value_( v ) + explicit atomic_count( long v ): value_( static_cast< std::int_least32_t >( v ) ) { } diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_sync.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_sync.hpp index b6359b5bcf..65b42c86a7 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_sync.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_sync.hpp @@ -15,10 +15,19 @@ // http://www.boost.org/LICENSE_1_0.txt) // +#include <boost/cstdint.hpp> + #if defined( __ia64__ ) && defined( __INTEL_COMPILER ) # include <ia64intrin.h> #endif +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using __sync atomic_count") + +#endif + namespace boost { @@ -29,7 +38,9 @@ class atomic_count { public: - explicit atomic_count( long v ) : value_( v ) {} + explicit atomic_count( long v ): value_( static_cast< boost::int_least32_t >( v ) ) + { + } long operator++() { @@ -51,7 +62,7 @@ private: atomic_count(atomic_count const &); atomic_count & operator=(atomic_count const &); - mutable long value_; + mutable boost::int_least32_t value_; }; } // namespace detail diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_win32.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_win32.hpp index 633e73c3c0..664d760e5f 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_win32.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_win32.hpp @@ -19,6 +19,13 @@ #include <boost/smart_ptr/detail/sp_interlocked.hpp> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using Win32 atomic_count") + +#endif + namespace boost { diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lightweight_mutex.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lightweight_mutex.hpp index d46b1932c2..7b098c4d9d 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lightweight_mutex.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lightweight_mutex.hpp @@ -28,15 +28,12 @@ #include <boost/config.hpp> -#if !defined(BOOST_HAS_THREADS) -# include <boost/smart_ptr/detail/lwm_nop.hpp> -#elif defined(BOOST_HAS_PTHREADS) -# include <boost/smart_ptr/detail/lwm_pthreads.hpp> -#elif defined(BOOST_HAS_WINTHREADS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +#if !defined(BOOST_NO_CXX11_HDR_MUTEX ) +# include <boost/smart_ptr/detail/lwm_std_mutex.hpp> +#elif defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # include <boost/smart_ptr/detail/lwm_win32_cs.hpp> #else -// Use #define BOOST_DISABLE_THREADS to avoid the error -# error Unrecognized threading platform +# include <boost/smart_ptr/detail/lwm_pthreads.hpp> #endif #endif // #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_counted_base.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_counted_base.hpp index fdfe2c65cd..f730419849 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_counted_base.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_counted_base.hpp @@ -27,7 +27,7 @@ namespace boost namespace detail { -class local_counted_base +class BOOST_SYMBOL_VISIBLE local_counted_base { private: @@ -89,7 +89,7 @@ public: } }; -class local_counted_impl: public local_counted_base +class BOOST_SYMBOL_VISIBLE local_counted_impl: public local_counted_base { private: @@ -101,41 +101,41 @@ private: public: - explicit local_counted_impl( shared_count const& pn ): pn_( pn ) + explicit local_counted_impl( shared_count const& pn ) BOOST_SP_NOEXCEPT: pn_( pn ) { } #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - explicit local_counted_impl( shared_count && pn ): pn_( std::move(pn) ) + explicit local_counted_impl( shared_count && pn ) BOOST_SP_NOEXCEPT: pn_( std::move(pn) ) { } #endif - virtual void local_cb_destroy() BOOST_SP_NOEXCEPT + void local_cb_destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { delete this; } - virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT + boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return pn_; } }; -class local_counted_impl_em: public local_counted_base +class BOOST_SYMBOL_VISIBLE local_counted_impl_em: public local_counted_base { public: shared_count pn_; - virtual void local_cb_destroy() BOOST_SP_NOEXCEPT + void local_cb_destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { shared_count().swap( pn_ ); } - virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT + boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return pn_; } diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_sp_deleter.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_sp_deleter.hpp index 7d04f1dc52..9ede7e36cc 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_sp_deleter.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_sp_deleter.hpp @@ -50,7 +50,7 @@ public: #endif - D& deleter() + D& deleter() BOOST_SP_NOEXCEPT { return d_; } @@ -74,12 +74,12 @@ template<> class local_sp_deleter<void> { }; -template<class D> D * get_local_deleter( local_sp_deleter<D> * p ) +template<class D> D * get_local_deleter( local_sp_deleter<D> * p ) BOOST_SP_NOEXCEPT { return &p->deleter(); } -inline void * get_local_deleter( local_sp_deleter<void> * /*p*/ ) +inline void * get_local_deleter( local_sp_deleter<void> * /*p*/ ) BOOST_SP_NOEXCEPT { return 0; } diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_nop.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_nop.hpp deleted file mode 100644 index 521a88ec1c..0000000000 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_nop.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_nop.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Distributed under 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) -// - -namespace boost -{ - -namespace detail -{ - -class lightweight_mutex -{ -public: - - typedef lightweight_mutex scoped_lock; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_std_mutex.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_std_mutex.hpp new file mode 100644 index 0000000000..5cb7490f00 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_std_mutex.hpp @@ -0,0 +1,62 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LWM_STD_MUTEX_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_STD_MUTEX_HPP_INCLUDED + +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt) + +#include <boost/assert.hpp> +#include <mutex> + +namespace boost +{ + +namespace detail +{ + +class lightweight_mutex +{ +private: + + std::mutex m_; + + lightweight_mutex(lightweight_mutex const &); + lightweight_mutex & operator=(lightweight_mutex const &); + +public: + + lightweight_mutex() + { + } + + class scoped_lock; + friend class scoped_lock; + + class scoped_lock + { + private: + + std::mutex & m_; + + scoped_lock(scoped_lock const &); + scoped_lock & operator=(scoped_lock const &); + + public: + + scoped_lock( lightweight_mutex & m ): m_( m.m_ ) + { + m_.lock(); + } + + ~scoped_lock() + { + m_.unlock(); + } + }; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_STD_MUTEX_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_win32_cs.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_win32_cs.hpp index 25b1f195b7..90decb2a32 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_win32_cs.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_win32_cs.hpp @@ -11,15 +11,12 @@ // boost/detail/lwm_win32_cs.hpp // // Copyright (c) 2002, 2003 Peter Dimov -// Copyright (c) Microsoft Corporation 2014 // // Distributed under 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) // -#include <boost/predef.h> - #ifdef BOOST_USE_WINDOWS_H #include <windows.h> @@ -52,28 +49,24 @@ struct critical_section #endif }; -#if BOOST_PLAT_WINDOWS_RUNTIME -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSectionEx(::_RTL_CRITICAL_SECTION *, unsigned long, unsigned long); -#else extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *); -#endif extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRITICAL_SECTION *); extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *); extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *); -#else +typedef ::_RTL_CRITICAL_SECTION rtl_critical_section; + +#else // #ifndef BOOST_USE_WINDOWS_H typedef ::CRITICAL_SECTION critical_section; -#if BOOST_PLAT_WINDOWS_RUNTIME -using ::InitializeCriticalSectionEx; -#else using ::InitializeCriticalSection; -#endif using ::EnterCriticalSection; using ::LeaveCriticalSection; using ::DeleteCriticalSection; +typedef ::CRITICAL_SECTION rtl_critical_section; + #endif // #ifndef BOOST_USE_WINDOWS_H class lightweight_mutex @@ -89,16 +82,12 @@ public: lightweight_mutex() { -#if BOOST_PLAT_WINDOWS_RUNTIME - boost::detail::InitializeCriticalSectionEx(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_), 4000, 0); -#else - boost::detail::InitializeCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); -#endif + boost::detail::InitializeCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_)); } ~lightweight_mutex() { - boost::detail::DeleteCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); + boost::detail::DeleteCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_)); } class scoped_lock; @@ -117,12 +106,12 @@ public: explicit scoped_lock(lightweight_mutex & m): m_(m) { - boost::detail::EnterCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); + boost::detail::EnterCriticalSection(reinterpret_cast< rtl_critical_section* >(&m_.cs_)); } ~scoped_lock() { - boost::detail::LeaveCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); + boost::detail::LeaveCriticalSection(reinterpret_cast< rtl_critical_section* >(&m_.cs_)); } }; }; diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/shared_count.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/shared_count.hpp index ae7d0fb46f..73a33ffeb0 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/shared_count.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/shared_count.hpp @@ -18,31 +18,29 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#ifdef __BORLANDC__ +#if defined(__BORLANDC__) && !defined(__clang__) # pragma warn -8027 // Functions containing try are not expanded inline #endif -#include <boost/config.hpp> -#include <boost/checked_delete.hpp> -#include <boost/throw_exception.hpp> #include <boost/smart_ptr/bad_weak_ptr.hpp> #include <boost/smart_ptr/detail/sp_counted_base.hpp> #include <boost/smart_ptr/detail/sp_counted_impl.hpp> #include <boost/smart_ptr/detail/sp_disable_deprecated.hpp> -#include <boost/detail/workaround.hpp> -// In order to avoid circular dependencies with Boost.TR1 -// we make sure that our include of <memory> doesn't try to -// pull in the TR1 headers: that's why we use this header -// rather than including <memory> directly: -#include <boost/config/no_tr1/memory.hpp> // std::auto_ptr -#include <functional> // std::less +#include <boost/smart_ptr/detail/sp_noexcept.hpp> +#include <boost/checked_delete.hpp> +#include <boost/throw_exception.hpp> +#include <boost/core/addressof.hpp> +#include <boost/config.hpp> +#include <boost/config/workaround.hpp> +#include <boost/cstdint.hpp> +#include <memory> // std::auto_ptr +#include <functional> // std::less +#include <cstddef> // std::size_t #ifdef BOOST_NO_EXCEPTIONS # include <new> // std::bad_alloc #endif -#include <boost/core/addressof.hpp> - #if defined( BOOST_SP_DISABLE_DEPRECATED ) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -102,6 +100,14 @@ template< class D > struct sp_convert_reference< D& > typedef sp_reference_wrapper< D > type; }; +template<class T> std::size_t sp_hash_pointer( T* p ) BOOST_NOEXCEPT +{ + boost::uintptr_t v = reinterpret_cast<boost::uintptr_t>( p ); + + // match boost::hash<T*> + return static_cast<std::size_t>( v + ( v >> 3 ) ); +} + class weak_count; class shared_count @@ -118,14 +124,14 @@ private: public: - BOOST_CONSTEXPR shared_count(): pi_(0) // nothrow + BOOST_CONSTEXPR shared_count() BOOST_SP_NOEXCEPT: pi_(0) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif { } - BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ): pi_( pi ) // nothrow + BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ) BOOST_SP_NOEXCEPT: pi_( pi ) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif @@ -381,7 +387,7 @@ public: { typedef typename sp_convert_reference<D>::type D2; - D2 d2( r.get_deleter() ); + D2 d2( static_cast<D&&>( r.get_deleter() ) ); pi_ = new sp_counted_impl_pd< typename std::unique_ptr<Y, D>::pointer, D2 >( r.get(), d2 ); #ifdef BOOST_NO_EXCEPTIONS @@ -421,7 +427,7 @@ public: r.release(); } - ~shared_count() // nothrow + ~shared_count() /*BOOST_SP_NOEXCEPT*/ { if( pi_ != 0 ) pi_->release(); #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) @@ -429,7 +435,7 @@ public: #endif } - shared_count(shared_count const & r): pi_(r.pi_) // nothrow + shared_count(shared_count const & r) BOOST_SP_NOEXCEPT: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif @@ -439,7 +445,7 @@ public: #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - shared_count(shared_count && r): pi_(r.pi_) // nothrow + shared_count(shared_count && r) BOOST_SP_NOEXCEPT: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif @@ -450,9 +456,9 @@ public: #endif explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 - shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0 + shared_count( weak_count const & r, sp_nothrow_tag ) BOOST_SP_NOEXCEPT; // constructs an empty *this when r.use_count() == 0 - shared_count & operator= (shared_count const & r) // nothrow + shared_count & operator= (shared_count const & r) BOOST_SP_NOEXCEPT { sp_counted_base * tmp = r.pi_; @@ -466,52 +472,61 @@ public: return *this; } - void swap(shared_count & r) // nothrow + void swap(shared_count & r) BOOST_SP_NOEXCEPT { sp_counted_base * tmp = r.pi_; r.pi_ = pi_; pi_ = tmp; } - long use_count() const // nothrow + long use_count() const BOOST_SP_NOEXCEPT { return pi_ != 0? pi_->use_count(): 0; } - bool unique() const // nothrow + bool unique() const BOOST_SP_NOEXCEPT { return use_count() == 1; } - bool empty() const // nothrow + bool empty() const BOOST_SP_NOEXCEPT { return pi_ == 0; } - friend inline bool operator==(shared_count const & a, shared_count const & b) + bool operator==( shared_count const & r ) const BOOST_SP_NOEXCEPT { - return a.pi_ == b.pi_; + return pi_ == r.pi_; } - friend inline bool operator<(shared_count const & a, shared_count const & b) + bool operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT; + + bool operator<( shared_count const & r ) const BOOST_SP_NOEXCEPT { - return std::less<sp_counted_base *>()( a.pi_, b.pi_ ); + return std::less<sp_counted_base *>()( pi_, r.pi_ ); } - void * get_deleter( sp_typeinfo const & ti ) const + bool operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT; + + void * get_deleter( sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT { return pi_? pi_->get_deleter( ti ): 0; } - void * get_local_deleter( sp_typeinfo const & ti ) const + void * get_local_deleter( sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT { return pi_? pi_->get_local_deleter( ti ): 0; } - void * get_untyped_deleter() const + void * get_untyped_deleter() const BOOST_SP_NOEXCEPT { return pi_? pi_->get_untyped_deleter(): 0; } + + std::size_t hash_value() const BOOST_SP_NOEXCEPT + { + return sp_hash_pointer( pi_ ); + } }; @@ -529,14 +544,14 @@ private: public: - BOOST_CONSTEXPR weak_count(): pi_(0) // nothrow + BOOST_CONSTEXPR weak_count() BOOST_SP_NOEXCEPT: pi_(0) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) #endif { } - weak_count(shared_count const & r): pi_(r.pi_) // nothrow + weak_count(shared_count const & r) BOOST_SP_NOEXCEPT: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) #endif @@ -544,7 +559,7 @@ public: if(pi_ != 0) pi_->weak_add_ref(); } - weak_count(weak_count const & r): pi_(r.pi_) // nothrow + weak_count(weak_count const & r) BOOST_SP_NOEXCEPT: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) #endif @@ -556,7 +571,7 @@ public: #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - weak_count(weak_count && r): pi_(r.pi_) // nothrow + weak_count(weak_count && r) BOOST_SP_NOEXCEPT: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) #endif @@ -566,7 +581,7 @@ public: #endif - ~weak_count() // nothrow + ~weak_count() /*BOOST_SP_NOEXCEPT*/ { if(pi_ != 0) pi_->weak_release(); #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) @@ -574,7 +589,7 @@ public: #endif } - weak_count & operator= (shared_count const & r) // nothrow + weak_count & operator= (shared_count const & r) BOOST_SP_NOEXCEPT { sp_counted_base * tmp = r.pi_; @@ -588,7 +603,7 @@ public: return *this; } - weak_count & operator= (weak_count const & r) // nothrow + weak_count & operator= (weak_count const & r) BOOST_SP_NOEXCEPT { sp_counted_base * tmp = r.pi_; @@ -602,31 +617,46 @@ public: return *this; } - void swap(weak_count & r) // nothrow + void swap(weak_count & r) BOOST_SP_NOEXCEPT { sp_counted_base * tmp = r.pi_; r.pi_ = pi_; pi_ = tmp; } - long use_count() const // nothrow + long use_count() const BOOST_SP_NOEXCEPT { return pi_ != 0? pi_->use_count(): 0; } - bool empty() const // nothrow + bool empty() const BOOST_SP_NOEXCEPT { return pi_ == 0; } - friend inline bool operator==(weak_count const & a, weak_count const & b) + bool operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT + { + return pi_ == r.pi_; + } + + bool operator==( shared_count const & r ) const BOOST_SP_NOEXCEPT { - return a.pi_ == b.pi_; + return pi_ == r.pi_; } - friend inline bool operator<(weak_count const & a, weak_count const & b) + bool operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT { - return std::less<sp_counted_base *>()(a.pi_, b.pi_); + return std::less<sp_counted_base *>()( pi_, r.pi_ ); + } + + bool operator<( shared_count const & r ) const BOOST_SP_NOEXCEPT + { + return std::less<sp_counted_base *>()( pi_, r.pi_ ); + } + + std::size_t hash_value() const BOOST_SP_NOEXCEPT + { + return sp_hash_pointer( pi_ ); } }; @@ -641,7 +671,7 @@ inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) } } -inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ ) +inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ) BOOST_SP_NOEXCEPT: pi_( r.pi_ ) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif @@ -652,6 +682,16 @@ inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( } } +inline bool shared_count::operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT +{ + return pi_ == r.pi_; +} + +inline bool shared_count::operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT +{ + return std::less<sp_counted_base *>()( pi_, r.pi_ ); +} + } // namespace detail } // namespace boost @@ -660,7 +700,7 @@ inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( #pragma GCC diagnostic pop #endif -#ifdef __BORLANDC__ +#if defined(__BORLANDC__) && !defined(__clang__) # pragma warn .8027 // Functions containing try are not expanded inline #endif diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_convertible.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_convertible.hpp index 4bba9ed444..af422883ce 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_convertible.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_convertible.hpp @@ -26,7 +26,7 @@ # define BOOST_SP_NO_SP_CONVERTIBLE #endif -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x630 ) +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_BORLANDC ) && ( BOOST_BORLANDC < 0x630 ) # define BOOST_SP_NO_SP_CONVERTIBLE #endif diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base.hpp index 438613765b..536926a580 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base.hpp @@ -17,14 +17,9 @@ // http://www.boost.org/LICENSE_1_0.txt) // +#include <boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp> +#include <boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp> #include <boost/config.hpp> -#include <boost/smart_ptr/detail/sp_has_sync.hpp> - -#if !defined( __c2__ ) && defined( __clang__ ) && defined( __has_extension ) -# if __has_extension( __c_atomic__ ) -# define BOOST_SP_HAS_CLANG_C11_ATOMICS -# endif -#endif #if defined( BOOST_SP_DISABLE_THREADS ) # include <boost/smart_ptr/detail/sp_counted_base_nt.hpp> @@ -41,18 +36,24 @@ #elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) # include <boost/smart_ptr/detail/sp_counted_base_nt.hpp> -#elif defined( BOOST_SP_HAS_CLANG_C11_ATOMICS ) -# include <boost/smart_ptr/detail/sp_counted_base_clang.hpp> +#elif defined( BOOST_SP_HAS_GCC_INTRINSICS ) +# include <boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp> #elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) # include <boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp> -#elif defined( __SNC__ ) -# include <boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp> +#elif defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) +# include <boost/smart_ptr/detail/sp_counted_base_sync.hpp> #elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined(__PATHSCALE__) # include <boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp> +#elif defined( BOOST_SP_HAS_SYNC_INTRINSICS ) +# include <boost/smart_ptr/detail/sp_counted_base_sync.hpp> + +#elif defined( __SNC__ ) +# include <boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp> + #elif defined(__HP_aCC) && defined(__ia64) # include <boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp> @@ -71,9 +72,6 @@ #elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__) && !defined( __mips16 ) # include <boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp> -#elif defined( BOOST_SP_HAS_SYNC ) -# include <boost/smart_ptr/detail/sp_counted_base_sync.hpp> - #elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) ) # include <boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp> @@ -91,6 +89,4 @@ #endif -#undef BOOST_SP_HAS_CLANG_C11_ATOMICS - #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp index ec6f6ee184..848251521e 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp @@ -15,9 +15,20 @@ // Lock-free algorithm by Alexander Terekhov // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_obsolete.hpp> +#include <boost/config.hpp> #include <machine/sys/inline.h> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using HP aCC++/HP-UX/IA64 sp_counted_base") + +#endif + +BOOST_SP_OBSOLETE() + namespace boost { @@ -71,7 +82,7 @@ inline int atomic_conditional_increment( int * pw ) } } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -103,8 +114,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp index ce8ee686ba..65dc11fd90 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp @@ -20,10 +20,18 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/config.hpp> #include <builtins.h> #include <sys/atomic_op.h> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using AIX sp_counted_base") + +#endif + namespace boost { @@ -63,7 +71,7 @@ inline int32_t atomic_conditional_increment( int32_t * pw ) } } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -95,8 +103,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp deleted file mode 100644 index 5d6e073d95..0000000000 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_clang.hpp - __c11 clang intrinsics -// -// Copyright (c) 2007, 2013, 2015 Peter Dimov -// -// Distributed under 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 - -#include <boost/detail/sp_typeinfo.hpp> -#include <boost/cstdint.hpp> - -namespace boost -{ - -namespace detail -{ - -typedef _Atomic( boost::int_least32_t ) atomic_int_least32_t; - -inline void atomic_increment( atomic_int_least32_t * pw ) -{ - __c11_atomic_fetch_add( pw, 1, __ATOMIC_RELAXED ); -} - -inline boost::int_least32_t atomic_decrement( atomic_int_least32_t * pw ) -{ - return __c11_atomic_fetch_sub( pw, 1, __ATOMIC_ACQ_REL ); -} - -inline boost::int_least32_t atomic_conditional_increment( atomic_int_least32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - boost::int_least32_t r = __c11_atomic_load( pw, __ATOMIC_RELAXED ); - - for( ;; ) - { - if( r == 0 ) - { - return r; - } - - if( __c11_atomic_compare_exchange_weak( pw, &r, r + 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED ) ) - { - return r; - } - } -} - -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wweak-vtables" -#endif - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - atomic_int_least32_t use_count_; // #shared - atomic_int_least32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base() - { - __c11_atomic_init( &use_count_, 1 ); - __c11_atomic_init( &weak_count_, 1 ); - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return __c11_atomic_load( const_cast< atomic_int_least32_t* >( &use_count_ ), __ATOMIC_ACQUIRE ); - } -}; - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp index 25dfe54c98..380b5c3932 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp @@ -24,7 +24,18 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_obsolete.hpp> +#include <boost/config.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using CodeWarrior/PowerPC sp_counted_base") + +#endif + +BOOST_SP_OBSOLETE() namespace boost { @@ -91,7 +102,7 @@ store: return a; } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -123,8 +134,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp new file mode 100644 index 0000000000..99ded0d4f2 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp @@ -0,0 +1,148 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_ATOMIC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_ATOMIC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_gcc_atomic.hpp - g++ 4.7+ __atomic intrinsics +// +// Copyright 2007, 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/config.hpp> +#include <boost/cstdint.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using __atomic sp_counted_base") + +#endif + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( boost::uint_least32_t * pw ) +{ + __atomic_fetch_add( pw, 1, __ATOMIC_RELAXED ); +} + +inline boost::uint_least32_t atomic_decrement( boost::uint_least32_t * pw ) +{ + return __atomic_fetch_sub( pw, 1, __ATOMIC_ACQ_REL ); +} + +inline boost::uint_least32_t atomic_conditional_increment( boost::uint_least32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + boost::uint_least32_t r = __atomic_load_n( pw, __ATOMIC_RELAXED ); + + for( ;; ) + { + if( r == 0 ) + { + return r; + } + + if( __atomic_compare_exchange_n( pw, &r, r + 1, true, __ATOMIC_RELAXED, __ATOMIC_RELAXED ) ) + { + return r; + } + } +} + +inline boost::uint_least32_t atomic_load( boost::uint_least32_t const * pw ) +{ + return __atomic_load_n( pw, __ATOMIC_ACQUIRE ); +} + +class BOOST_SYMBOL_VISIBLE sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + boost::uint_least32_t use_count_; // #shared + boost::uint_least32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return atomic_load( &use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp index 6c3cce8d44..a6492ec98f 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp @@ -16,7 +16,18 @@ // Lock-free algorithm by Alexander Terekhov // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_obsolete.hpp> +#include <boost/config.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using g++/IA64 sp_counted_base") + +#endif + +BOOST_SP_OBSOLETE() namespace boost { @@ -78,7 +89,7 @@ inline int atomic_conditional_increment( int * pw ) return rv; } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -110,8 +121,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp index c3175cf8ed..3d3c7d3bf9 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp @@ -20,7 +20,18 @@ // Lock-free algorithm by Alexander Terekhov // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_obsolete.hpp> +#include <boost/config.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using g++/MIPS sp_counted_base") + +#endif + +BOOST_SP_OBSOLETE() namespace boost { @@ -108,7 +119,7 @@ inline int atomic_conditional_increment( int * pw ) return rv; } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -140,8 +151,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp index 0fb807488a..12c8774c4d 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp @@ -24,7 +24,18 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_obsolete.hpp> +#include <boost/config.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using g++/PowerPC sp_counted_base") + +#endif + +BOOST_SP_OBSOLETE() namespace boost { @@ -102,7 +113,7 @@ inline int atomic_conditional_increment( int * pw ) return rv; } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -134,8 +145,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp index b8bb707f1b..a30e2a7a54 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp @@ -19,9 +19,20 @@ // // Thanks to Michael van der Westhuizen -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_obsolete.hpp> +#include <boost/config.hpp> #include <inttypes.h> // int32_t +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using g++/Sparc sp_counted_base") + +#endif + +BOOST_SP_OBSOLETE() + namespace boost { @@ -87,7 +98,7 @@ inline int32_t atomic_conditional_increment( int32_t * pw ) } } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -119,8 +130,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp index 3d2dd61ed6..420265d4d3 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp @@ -24,7 +24,18 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_obsolete.hpp> +#include <boost/config.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using g++/x86 sp_counted_base") + +#endif + +BOOST_SP_OBSOLETE() namespace boost { @@ -94,7 +105,7 @@ inline int atomic_conditional_increment( int * pw ) return rv; } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -126,8 +137,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp index dea905c905..eb37a79439 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp @@ -18,7 +18,17 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_noexcept.hpp> +#include <boost/config.hpp> +#include <boost/cstdint.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using single-threaded, non-atomic sp_counted_base") + +#endif namespace boost { @@ -26,55 +36,55 @@ namespace boost namespace detail { -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: sp_counted_base( sp_counted_base const & ); sp_counted_base & operator= ( sp_counted_base const & ); - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) + boost::int_least32_t use_count_; // #shared + boost::int_least32_t weak_count_; // #weak + (#shared != 0) public: - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + sp_counted_base() BOOST_SP_NOEXCEPT: use_count_( 1 ), weak_count_( 1 ) { } - virtual ~sp_counted_base() // nothrow + virtual ~sp_counted_base() /*BOOST_SP_NOEXCEPT*/ { } // dispose() is called when use_count_ drops to zero, to release // the resources managed by *this. - virtual void dispose() = 0; // nothrow + virtual void dispose() BOOST_SP_NOEXCEPT = 0; // nothrow // destroy() is called when weak_count_ drops to zero. - virtual void destroy() // nothrow + virtual void destroy() BOOST_SP_NOEXCEPT // nothrow { delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0; - void add_ref_copy() + void add_ref_copy() BOOST_SP_NOEXCEPT { ++use_count_; } - bool add_ref_lock() // true on success + bool add_ref_lock() BOOST_SP_NOEXCEPT // true on success { if( use_count_ == 0 ) return false; ++use_count_; return true; } - void release() // nothrow + void release() BOOST_SP_NOEXCEPT { if( --use_count_ == 0 ) { @@ -83,12 +93,12 @@ public: } } - void weak_add_ref() // nothrow + void weak_add_ref() BOOST_SP_NOEXCEPT { ++weak_count_; } - void weak_release() // nothrow + void weak_release() BOOST_SP_NOEXCEPT { if( --weak_count_ == 0 ) { @@ -96,7 +106,7 @@ public: } } - long use_count() const // nothrow + long use_count() const BOOST_SP_NOEXCEPT { return use_count_; } diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp index 85f2563d5d..b296e2d368 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp @@ -18,25 +18,34 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/assert.hpp> +#include <boost/config.hpp> +#include <boost/cstdint.hpp> #include <pthread.h> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using pthread_mutex sp_counted_base") + +#endif + namespace boost { namespace detail { -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: sp_counted_base( sp_counted_base const & ); sp_counted_base & operator= ( sp_counted_base const & ); - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) + boost::int_least32_t use_count_; // #shared + boost::int_least32_t weak_count_; // #weak + (#shared != 0) mutable pthread_mutex_t m_; @@ -70,8 +79,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() @@ -92,7 +101,7 @@ public: void release() // nothrow { BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - long new_use_count = --use_count_; + boost::int_least32_t new_use_count = --use_count_; BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); if( new_use_count == 0 ) @@ -112,7 +121,7 @@ public: void weak_release() // nothrow { BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - long new_weak_count = --weak_count_; + boost::int_least32_t new_weak_count = --weak_count_; BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); if( new_weak_count == 0 ) @@ -124,7 +133,7 @@ public: long use_count() const // nothrow { BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - long r = use_count_; + boost::int_least32_t r = use_count_; BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); return r; diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp index 7b5f9178a6..fc84ec1176 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp @@ -6,7 +6,7 @@ # pragma once #endif -// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ +// detail/sp_counted_base_gcc_snc_ps3.hpp - PS3 Cell // // Copyright (c) 2006 Piotr Wyderski // Copyright (c) 2006 Tomas Puverle @@ -19,9 +19,20 @@ // // Thanks to Michael van der Westhuizen -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_obsolete.hpp> +#include <boost/config.hpp> #include <inttypes.h> // uint32_t +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using PS3 sp_counted_base") + +#endif + +BOOST_SP_OBSOLETE() + namespace boost { @@ -82,7 +93,7 @@ inline uint32_t atomic_conditional_increment( uint32_t * pw ) } } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -114,8 +125,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp index faf503ad57..4412cee447 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp @@ -18,8 +18,16 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/smart_ptr/detail/spinlock_pool.hpp> +#include <boost/config.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using spinlock-based sp_counted_base") + +#endif namespace boost { @@ -51,7 +59,7 @@ inline int atomic_conditional_increment( int * pw ) return rv; } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -83,8 +91,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp index 9f562b9b4a..52acf92b94 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp @@ -15,27 +15,36 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_noexcept.hpp> +#include <boost/config.hpp> #include <atomic> #include <cstdint> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using std::atomic sp_counted_base") + +#endif + namespace boost { namespace detail { -inline void atomic_increment( std::atomic_int_least32_t * pw ) +inline void atomic_increment( std::atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT { pw->fetch_add( 1, std::memory_order_relaxed ); } -inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw ) +inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT { return pw->fetch_sub( 1, std::memory_order_acq_rel ); } -inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw ) +inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT { // long r = *pw; // if( r != 0 ) ++*pw; @@ -57,7 +66,7 @@ inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_ } } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -69,41 +78,41 @@ private: public: - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + sp_counted_base() BOOST_SP_NOEXCEPT: use_count_( 1 ), weak_count_( 1 ) { } - virtual ~sp_counted_base() // nothrow + virtual ~sp_counted_base() /*BOOST_SP_NOEXCEPT*/ { } // dispose() is called when use_count_ drops to zero, to release // the resources managed by *this. - virtual void dispose() = 0; // nothrow + virtual void dispose() BOOST_SP_NOEXCEPT = 0; // destroy() is called when weak_count_ drops to zero. - virtual void destroy() // nothrow + virtual void destroy() BOOST_SP_NOEXCEPT { delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0; - void add_ref_copy() + void add_ref_copy() BOOST_SP_NOEXCEPT { atomic_increment( &use_count_ ); } - bool add_ref_lock() // true on success + bool add_ref_lock() BOOST_SP_NOEXCEPT // true on success { return atomic_conditional_increment( &use_count_ ) != 0; } - void release() // nothrow + void release() BOOST_SP_NOEXCEPT { if( atomic_decrement( &use_count_ ) == 1 ) { @@ -112,12 +121,12 @@ public: } } - void weak_add_ref() // nothrow + void weak_add_ref() BOOST_SP_NOEXCEPT { atomic_increment( &weak_count_ ); } - void weak_release() // nothrow + void weak_release() BOOST_SP_NOEXCEPT { if( atomic_decrement( &weak_count_ ) == 1 ) { @@ -125,7 +134,7 @@ public: } } - long use_count() const // nothrow + long use_count() const BOOST_SP_NOEXCEPT { return use_count_.load( std::memory_order_acquire ); } diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp index d2138e7c26..111410eb11 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp @@ -15,13 +15,21 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/config.hpp> #include <limits.h> #if defined( __ia64__ ) && defined( __INTEL_COMPILER ) # include <ia64intrin.h> #endif +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using __sync sp_counted_base") + +#endif + namespace boost { @@ -76,7 +84,7 @@ inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw ) } } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -108,8 +116,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp index f2de3b02d8..d3e54429cb 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp @@ -21,7 +21,18 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/smart_ptr/detail/sp_obsolete.hpp> +#include <boost/config.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using xlC/PowerPC sp_counted_base") + +#endif + +BOOST_SP_OBSOLETE() extern "builtin" void __lwsync(void); extern "builtin" void __isync(void); @@ -70,7 +81,7 @@ inline int atomic_conditional_increment( int *pw ) } } -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -103,8 +114,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp index 960e42e128..dc0df4acb6 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp @@ -25,8 +25,16 @@ // #include <boost/smart_ptr/detail/sp_interlocked.hpp> -#include <boost/detail/workaround.hpp> -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/config/workaround.hpp> +#include <boost/config.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using Win32 sp_counted_base") + +#endif namespace boost { @@ -34,7 +42,7 @@ namespace boost namespace detail { -class sp_counted_base +class BOOST_SYMBOL_VISIBLE sp_counted_base { private: @@ -66,8 +74,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_impl.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_impl.hpp index fa2f75eb1a..b21685e83f 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_impl.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_impl.hpp @@ -18,24 +18,21 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/config.hpp> - #if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR) # error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible. #endif -#include <boost/checked_delete.hpp> #include <boost/smart_ptr/detail/sp_counted_base.hpp> +#include <boost/smart_ptr/detail/sp_noexcept.hpp> +#include <boost/checked_delete.hpp> #include <boost/core/addressof.hpp> +#include <boost/config.hpp> #if defined(BOOST_SP_USE_QUICK_ALLOCATOR) #include <boost/smart_ptr/detail/quick_allocator.hpp> #endif -#if defined(BOOST_SP_USE_STD_ALLOCATOR) -#include <memory> // std::allocator -#endif - +#include <memory> // std::allocator, std::allocator_traits #include <cstddef> // std::size_t namespace boost @@ -55,16 +52,16 @@ namespace detail template<class D> class local_sp_deleter; -template<class D> D * get_local_deleter( D * /*p*/ ) +template<class D> D * get_local_deleter( D * /*p*/ ) BOOST_SP_NOEXCEPT { return 0; } -template<class D> D * get_local_deleter( local_sp_deleter<D> * p ); +template<class D> D * get_local_deleter( local_sp_deleter<D> * p ) BOOST_SP_NOEXCEPT; // -template<class X> class sp_counted_impl_p: public sp_counted_base +template<class X> class BOOST_SYMBOL_VISIBLE sp_counted_impl_p: public sp_counted_base { private: @@ -84,7 +81,7 @@ public: #endif } - virtual void dispose() // nothrow + void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) boost::sp_scalar_destructor_hook( px_, sizeof(X), this ); @@ -92,17 +89,17 @@ public: boost::checked_delete( px_ ); } - virtual void * get_deleter( sp_typeinfo const & ) + void * get_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return 0; } - virtual void * get_local_deleter( sp_typeinfo const & ) + void * get_local_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return 0; } - virtual void * get_untyped_deleter() + void * get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return 0; } @@ -143,12 +140,12 @@ public: # pragma option push -Vx- #endif -template<class P, class D> class sp_counted_impl_pd: public sp_counted_base +template<class P, class D> class BOOST_SYMBOL_VISIBLE sp_counted_impl_pd: public sp_counted_base { private: P ptr; // copy constructor must not throw - D del; // copy constructor must not throw + D del; // copy/move constructor must not throw sp_counted_impl_pd( sp_counted_impl_pd const & ); sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & ); @@ -159,30 +156,40 @@ public: // pre: d(p) must not throw +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + sp_counted_impl_pd( P p, D & d ): ptr( p ), del( static_cast< D&& >( d ) ) + { + } + +#else + sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d ) { } +#endif + sp_counted_impl_pd( P p ): ptr( p ), del() { } - virtual void dispose() // nothrow + void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { del( ptr ); } - virtual void * get_deleter( sp_typeinfo const & ti ) + void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE { - return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0; + return ti == BOOST_SP_TYPEID_(D)? &reinterpret_cast<char&>( del ): 0; } - virtual void * get_local_deleter( sp_typeinfo const & ti ) + void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE { - return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; + return ti == BOOST_SP_TYPEID_(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; } - virtual void * get_untyped_deleter() + void * get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return &reinterpret_cast<char&>( del ); } @@ -216,12 +223,12 @@ public: #endif }; -template<class P, class D, class A> class sp_counted_impl_pda: public sp_counted_base +template<class P, class D, class A> class BOOST_SYMBOL_VISIBLE sp_counted_impl_pda: public sp_counted_base { private: P p_; // copy constructor must not throw - D d_; // copy constructor must not throw + D d_; // copy/move constructor must not throw A a_; // copy constructor must not throw sp_counted_impl_pda( sp_counted_impl_pda const & ); @@ -233,20 +240,30 @@ public: // pre: d( p ) must not throw +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( static_cast< D&& >( d ) ), a_( a ) + { + } + +#else + sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a ) { } +#endif + sp_counted_impl_pda( P p, A a ): p_( p ), d_( a ), a_( a ) { } - virtual void dispose() // nothrow + void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { d_( p_ ); } - virtual void destroy() // nothrow + void destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { #if !defined( BOOST_NO_CXX11_ALLOCATOR ) @@ -265,17 +282,17 @@ public: a2.deallocate( this, 1 ); } - virtual void * get_deleter( sp_typeinfo const & ti ) + void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE { - return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0; + return ti == BOOST_SP_TYPEID_( D )? &reinterpret_cast<char&>( d_ ): 0; } - virtual void * get_local_deleter( sp_typeinfo const & ti ) + void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE { - return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; + return ti == BOOST_SP_TYPEID_( D )? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; } - virtual void * get_untyped_deleter() + void * get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { return &reinterpret_cast<char&>( d_ ); } diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp new file mode 100644 index 0000000000..2e15f7909e --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp @@ -0,0 +1,27 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_GCC_INTRINSICS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_HAS_GCC_INTRINSICS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + + +// boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp +// +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +// +// Defines the BOOST_SP_HAS_GCC_INTRINSICS macro if the __atomic_* +// intrinsics are available. + + +#if defined( __ATOMIC_RELAXED ) && defined( __ATOMIC_ACQUIRE ) && defined( __ATOMIC_RELEASE ) && defined( __ATOMIC_ACQ_REL ) + +# define BOOST_SP_HAS_GCC_INTRINSICS + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_GCC_INTRINSICS_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync.hpp deleted file mode 100644 index e1debf0cc9..0000000000 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/smart_ptr/detail/sp_has_sync.hpp -// -// Copyright (c) 2008, 2009 Peter Dimov -// -// Distributed under 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) -// -// Defines the BOOST_SP_HAS_SYNC macro if the __sync_* intrinsics -// are available. -// - -#ifndef BOOST_SP_NO_SYNC - -#if !defined( __c2__ ) && defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) - -# define BOOST_SP_HAS_SYNC - -#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 ) && !defined( __COMPILER_VER__ ) - -# define BOOST_SP_HAS_SYNC - -#elif !defined( __c2__ ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) - -#define BOOST_SP_HAS_SYNC - -#if defined( __arm__ ) || defined( __armel__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __hppa ) || defined( __hppa__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __m68k__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __sh__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __sparc__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1110 ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined(__PATHSCALE__) && ((__PATHCC__ == 4) && (__PATHCC_MINOR__ < 9)) -#undef BOOST_SP_HAS_SYNC -#endif - -#endif - -#endif // #ifndef BOOST_SP_NO_SYNC - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp new file mode 100644 index 0000000000..875d8692b9 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp @@ -0,0 +1,69 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_INTRINSICS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_INTRINSICS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp +// +// Copyright (c) 2008, 2009 Peter Dimov +// +// Distributed under 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) +// +// Defines the BOOST_SP_HAS_SYNC_INTRINSICS macro if the __sync_* intrinsics +// are available. +// + +#if !defined( BOOST_SP_NO_SYNC_INTRINSICS ) && !defined( BOOST_SP_NO_SYNC ) + +#if defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) && !defined( __c2__ ) + +# define BOOST_SP_HAS_SYNC_INTRINSICS + +#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 ) && !defined( __COMPILER_VER__ ) + +# define BOOST_SP_HAS_SYNC_INTRINSICS + +#elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __c2__ ) + +#define BOOST_SP_HAS_SYNC_INTRINSICS + +#if defined( __arm__ ) || defined( __armel__ ) +#undef BOOST_SP_HAS_SYNC_INTRINSICS +#endif + +#if defined( __hppa ) || defined( __hppa__ ) +#undef BOOST_SP_HAS_SYNC_INTRINSICS +#endif + +#if defined( __m68k__ ) +#undef BOOST_SP_HAS_SYNC_INTRINSICS +#endif + +#if defined( __sh__ ) +#undef BOOST_SP_HAS_SYNC_INTRINSICS +#endif + +#if defined( __sparc__ ) +#undef BOOST_SP_HAS_SYNC_INTRINSICS +#endif + +#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1110 ) +#undef BOOST_SP_HAS_SYNC_INTRINSICS +#endif + +#if defined(__PATHSCALE__) && ((__PATHCC__ == 4) && (__PATHCC_MINOR__ < 9)) +#undef BOOST_SP_HAS_SYNC_INTRINSICS +#endif + +#endif + +#endif // #if !defined( BOOST_SP_NO_SYNC_INTRINSICS ) && !defined( BOOST_SP_NO_SYNC ) + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_INTRINSICS_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_interlocked.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_interlocked.hpp index 79cae14a37..e181b8eeae 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_interlocked.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_interlocked.hpp @@ -32,11 +32,21 @@ // MinGW-w64 provides intrin.h for both 32 and 64-bit targets. # define BOOST_SP_HAS_INTRIN_H +#elif defined( __LP64__ ) + +// We have to use intrin.h on Cygwin 64 +# define BOOST_SP_HAS_INTRIN_H + // Intel C++ on Windows on VC10+ stdlib #elif defined( BOOST_INTEL_WIN ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520 # define BOOST_SP_HAS_INTRIN_H +// clang-cl on Windows on VC10+ stdlib +#elif defined( __clang__ ) && defined( _MSC_VER ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520 + +# define BOOST_SP_HAS_INTRIN_H + #endif #if defined( BOOST_USE_WINDOWS_H ) diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_obsolete.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_obsolete.hpp new file mode 100644 index 0000000000..021e72e9b4 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_obsolete.hpp @@ -0,0 +1,32 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_OBSOLETE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_OBSOLETE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + + +// boost/smart_ptr/detail/sp_obsolete.hpp +// +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +// +// Defines the BOOST_SP_OBSOLETE macro that emits a deprecation +// message. + +#include <boost/config/pragma_message.hpp> + +#if !defined( BOOST_SP_NO_OBSOLETE_MESSAGE ) + +#define BOOST_SP_OBSOLETE() BOOST_PRAGMA_MESSAGE("This platform-specific implementation is presumed obsolete and is slated for removal. If you want it retained, please open an issue in https://github.com/boostorg/smart_ptr.") + +#else + +#define BOOST_SP_OBSOLETE() + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_OBSOLETE_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_pause.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_pause.hpp new file mode 100644 index 0000000000..2cddd90b01 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_pause.hpp @@ -0,0 +1,51 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/smart_ptr/detail/sp_thread_pause.hpp +// +// inline void bost::detail::sp_thread_pause(); +// +// Emits a "pause" instruction. +// +// Copyright 2008, 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// https://www.boost.org/LICENSE_1_0.txt + +#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) && !defined(__c2__) + +extern "C" void _mm_pause(); + +#define BOOST_SP_PAUSE _mm_pause(); + +#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) + +#define BOOST_SP_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); + +#else + +#define BOOST_SP_PAUSE + +#endif + +namespace boost +{ +namespace detail +{ + +inline void sp_thread_pause() +{ + BOOST_SP_PAUSE +} + +} // namespace detail +} // namespace boost + +#undef BOOST_SP_PAUSE + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp new file mode 100644 index 0000000000..ff1d168808 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp @@ -0,0 +1,104 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/smart_ptr/detail/sp_thread_sleep.hpp +// +// inline void bost::detail::sp_thread_sleep(); +// +// Cease execution for a while to yield to other threads, +// as if by calling nanosleep() with an appropriate interval. +// +// Copyright 2008, 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/config.hpp> +#include <boost/config/pragma_message.hpp> + +#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + BOOST_PRAGMA_MESSAGE("Using Sleep(1) in sp_thread_sleep") +#endif + +#include <boost/smart_ptr/detail/sp_win32_sleep.hpp> + +namespace boost +{ + +namespace detail +{ + +inline void sp_thread_sleep() +{ + Sleep( 1 ); +} + +} // namespace detail + +} // namespace boost + +#elif defined(BOOST_HAS_NANOSLEEP) + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + BOOST_PRAGMA_MESSAGE("Using nanosleep() in sp_thread_sleep") +#endif + +#include <time.h> + +namespace boost +{ + +namespace detail +{ + +inline void sp_thread_sleep() +{ + // g++ -Wextra warns on {} or {0} + struct timespec rqtp = { 0, 0 }; + + // POSIX says that timespec has tv_sec and tv_nsec + // But it doesn't guarantee order or placement + + rqtp.tv_sec = 0; + rqtp.tv_nsec = 1000; + + nanosleep( &rqtp, 0 ); +} + +} // namespace detail + +} // namespace boost + +#else + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + BOOST_PRAGMA_MESSAGE("Using sp_thread_yield() in sp_thread_sleep") +#endif + +#include <boost/smart_ptr/detail/sp_thread_yield.hpp> + +namespace boost +{ + +namespace detail +{ + +inline void sp_thread_sleep() +{ + sp_thread_yield(); +} + +} // namespace detail + +} // namespace boost + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_yield.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_yield.hpp new file mode 100644 index 0000000000..9a221cc274 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_yield.hpp @@ -0,0 +1,100 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/smart_ptr/detail/sp_thread_yield.hpp +// +// inline void bost::detail::sp_thread_yield(); +// +// Gives up the remainder of the time slice, +// as if by calling sched_yield(). +// +// Copyright 2008, 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/config.hpp> +#include <boost/config/pragma_message.hpp> + +#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + BOOST_PRAGMA_MESSAGE("Using Sleep(0) in sp_thread_yield") +#endif + +#include <boost/smart_ptr/detail/sp_win32_sleep.hpp> + +namespace boost +{ + +namespace detail +{ + +inline void sp_thread_yield() +{ + Sleep( 0 ); +} + +} // namespace detail + +} // namespace boost + +#elif defined(BOOST_HAS_SCHED_YIELD) + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + BOOST_PRAGMA_MESSAGE("Using sched_yield() in sp_thread_yield") +#endif + +#ifndef _AIX +# include <sched.h> +#else + // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var + extern "C" int sched_yield(void); +#endif + +namespace boost +{ + +namespace detail +{ + +inline void sp_thread_yield() +{ + sched_yield(); +} + +} // namespace detail + +} // namespace boost + +#else + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + BOOST_PRAGMA_MESSAGE("Using sp_thread_pause() in sp_thread_yield") +#endif + +#include <boost/smart_ptr/detail/sp_thread_pause.hpp> + +namespace boost +{ + +namespace detail +{ + +inline void sp_thread_yield() +{ + sp_thread_pause(); +} + +} // namespace detail + +} // namespace boost + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_typeinfo_.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_typeinfo_.hpp new file mode 100644 index 0000000000..287bf72818 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_typeinfo_.hpp @@ -0,0 +1,58 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_TYPEINFO_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_TYPEINFO_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// smart_ptr/detail/sp_typeinfo_.hpp +// +// Copyright 2007, 2019 Peter Dimov +// +// Distributed under 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) + +#include <boost/config.hpp> + +#if defined( BOOST_NO_TYPEID ) || defined( BOOST_NO_STD_TYPEINFO ) + +#include <boost/core/typeinfo.hpp> + +namespace boost +{ + +namespace detail +{ + +typedef boost::core::typeinfo sp_typeinfo_; + +} // namespace detail + +} // namespace boost + +#define BOOST_SP_TYPEID_(T) BOOST_CORE_TYPEID(T) + +#else // defined( BOOST_NO_TYPEID ) || defined( BOOST_NO_STD_TYPEINFO ) + +#include <typeinfo> + +namespace boost +{ + +namespace detail +{ + +typedef std::type_info sp_typeinfo_; + +} // namespace detail + +} // namespace boost + +#define BOOST_SP_TYPEID_(T) typeid(T) + +#endif // defined( BOOST_NO_TYPEID ) || defined( BOOST_NO_STD_TYPEINFO ) + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_TYPEINFO_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_win32_sleep.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_win32_sleep.hpp new file mode 100644 index 0000000000..139a569fb7 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_win32_sleep.hpp @@ -0,0 +1,49 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/smart_ptr/detail/sp_win32_sleep.hpp +// +// Declares the Win32 Sleep() function. +// +// Copyright 2008, 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// https://www.boost.org/LICENSE_1_0.txt + +#if defined( BOOST_USE_WINDOWS_H ) +# include <windows.h> +#endif + +namespace boost +{ +namespace detail +{ + +#if !defined( BOOST_USE_WINDOWS_H ) + +#if defined(__clang__) && defined(__x86_64__) +// clang x64 warns that __stdcall is ignored +# define BOOST_SP_STDCALL +#else +# define BOOST_SP_STDCALL __stdcall +#endif + +#if defined(__LP64__) // Cygwin 64 + extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned int ms ); +#else + extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned long ms ); +#endif + +#undef BOOST_SP_STDCALL + +#endif // !defined( BOOST_USE_WINDOWS_H ) + +} // namespace detail +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock.hpp index 0b618dfc15..26e1b081e3 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock.hpp @@ -28,28 +28,26 @@ // #define BOOST_DETAIL_SPINLOCK_INIT <unspecified> // +#include <boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp> +#include <boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp> #include <boost/config.hpp> -#include <boost/smart_ptr/detail/sp_has_sync.hpp> #if defined( BOOST_SP_USE_STD_ATOMIC ) -# if !defined( __clang__ ) -# include <boost/smart_ptr/detail/spinlock_std_atomic.hpp> -# else -// Clang (at least up to 3.4) can't compile spinlock_pool when -// using std::atomic, so substitute the __sync implementation instead. -# include <boost/smart_ptr/detail/spinlock_sync.hpp> -# endif +# include <boost/smart_ptr/detail/spinlock_std_atomic.hpp> #elif defined( BOOST_SP_USE_PTHREADS ) # include <boost/smart_ptr/detail/spinlock_pt.hpp> +#elif defined( BOOST_SP_HAS_GCC_INTRINSICS ) +# include <boost/smart_ptr/detail/spinlock_gcc_atomic.hpp> + #elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) # include <boost/smart_ptr/detail/spinlock_std_atomic.hpp> #elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) # include <boost/smart_ptr/detail/spinlock_gcc_arm.hpp> -#elif defined( BOOST_SP_HAS_SYNC ) +#elif defined( BOOST_SP_HAS_SYNC_INTRINSICS ) # include <boost/smart_ptr/detail/spinlock_sync.hpp> #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp index 24d08a8815..e618f6e592 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp @@ -11,6 +11,13 @@ #include <boost/smart_ptr/detail/yield_k.hpp> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using g++/ARM spinlock") + +#endif + #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__) # define BOOST_SP_ARM_BARRIER "dmb" diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp new file mode 100644 index 0000000000..8cd71791e4 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp @@ -0,0 +1,85 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// Copyright 2008, 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/smart_ptr/detail/yield_k.hpp> + +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using __atomic spinlock") + +#endif + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + unsigned char v_; + +public: + + bool try_lock() + { + return __atomic_test_and_set( &v_, __ATOMIC_ACQUIRE ) == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + __atomic_clear( &v_, __ATOMIC_RELEASE ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_nt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_nt.hpp index 1f399d0dd4..ce23761fa5 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_nt.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_nt.hpp @@ -17,6 +17,13 @@ #include <boost/assert.hpp> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using single-threaded spinlock emulation") + +#endif + namespace boost { diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pt.hpp index f9cabfc3a7..a7f8a817bd 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pt.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pt.hpp @@ -17,6 +17,13 @@ #include <pthread.h> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using pthread_mutex spinlock emulation") + +#endif + namespace boost { diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp index a61c1cd96d..458370c505 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp @@ -16,8 +16,16 @@ // #include <boost/smart_ptr/detail/yield_k.hpp> +#include <boost/config.hpp> #include <atomic> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using std::atomic spinlock") + +#endif + namespace boost { @@ -32,12 +40,12 @@ public: public: - bool try_lock() + bool try_lock() BOOST_NOEXCEPT { return !v_.test_and_set( std::memory_order_acquire ); } - void lock() + void lock() BOOST_NOEXCEPT { for( unsigned k = 0; !try_lock(); ++k ) { @@ -45,7 +53,7 @@ public: } } - void unlock() + void unlock() BOOST_NOEXCEPT { v_ .clear( std::memory_order_release ); } @@ -63,12 +71,12 @@ public: public: - explicit scoped_lock( spinlock & sp ): sp_( sp ) + explicit scoped_lock( spinlock & sp ) BOOST_NOEXCEPT: sp_( sp ) { sp.lock(); } - ~scoped_lock() + ~scoped_lock() /*BOOST_NOEXCEPT*/ { sp_.unlock(); } diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_sync.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_sync.hpp index a7145c5ac2..cbfdd94f49 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_sync.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_sync.hpp @@ -21,6 +21,13 @@ # include <ia64intrin.h> #endif +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using __sync spinlock") + +#endif + namespace boost { @@ -31,7 +38,7 @@ class spinlock { public: - int v_; + unsigned char v_; public: diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_w32.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_w32.hpp index d34e4fc2b5..39092ce81e 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_w32.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_w32.hpp @@ -18,6 +18,13 @@ #include <boost/smart_ptr/detail/sp_interlocked.hpp> #include <boost/smart_ptr/detail/yield_k.hpp> +#if defined(BOOST_SP_REPORT_IMPLEMENTATION) + +#include <boost/config/pragma_message.hpp> +BOOST_PRAGMA_MESSAGE("Using Win32 spinlock") + +#endif + // BOOST_COMPILER_FENCE #if defined(__INTEL_COMPILER) diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp index f8ca6b6467..d9a1b46ab6 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp @@ -7,51 +7,21 @@ # pragma once #endif +// boost/smart_ptr/detail/yield_k.hpp // -// yield_k.hpp +// Copyright 2008, 2020 Peter Dimov // -// Copyright (c) 2008 Peter Dimov -// Copyright (c) Microsoft Corporation 2014 +// inline void boost::detail::yield( unsigned k ); // -// void yield( unsigned k ); -// -// Typical use: -// -// for( unsigned k = 0; !try_lock(); ++k ) yield( k ); -// -// Distributed under 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 +// Typical use: +// for( unsigned k = 0; !try_lock(); ++k ) yield( k ); // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +#include <boost/smart_ptr/detail/sp_thread_pause.hpp> +#include <boost/smart_ptr/detail/sp_thread_sleep.hpp> #include <boost/config.hpp> -#include <boost/predef.h> - -#if BOOST_PLAT_WINDOWS_RUNTIME -#include <thread> -#endif - -// BOOST_SMT_PAUSE - -#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) && !defined(__c2__) - -extern "C" void _mm_pause(); - -#define BOOST_SMT_PAUSE _mm_pause(); - -#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) - -#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); - -#endif - -// - -#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) - -#if defined( BOOST_USE_WINDOWS_H ) -# include <windows.h> -#endif namespace boost { @@ -59,96 +29,18 @@ namespace boost namespace detail { -#if !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME -#if !BOOST_COMP_CLANG || !defined __MINGW32__ - extern "C" void __stdcall Sleep( unsigned long ms ); -#else -#include <_mingw.h> -#if !defined __MINGW64_VERSION_MAJOR - extern "C" void __stdcall Sleep( unsigned long ms ); -#else - extern "C" __declspec(dllimport) void __stdcall Sleep( unsigned long ms ); -#endif -#endif -#endif - inline void yield( unsigned k ) { - if( k < 4 ) - { - } -#if defined( BOOST_SMT_PAUSE ) - else if( k < 16 ) - { - BOOST_SMT_PAUSE - } -#endif -#if !BOOST_PLAT_WINDOWS_RUNTIME - else if( k < 32 ) - { - Sleep( 0 ); - } - else - { - Sleep( 1 ); - } -#else - else - { - // Sleep isn't supported on the Windows Runtime. - std::this_thread::yield(); - } -#endif -} - -} // namespace detail + // Experiments on Windows and Fedora 32 show that a single pause, + // followed by an immediate sp_thread_sleep(), is best. -} // namespace boost - -#elif defined( BOOST_HAS_PTHREADS ) - -#ifndef _AIX -#include <sched.h> -#else - // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var - extern "C" int sched_yield(void); -#endif - -#include <time.h> - -namespace boost -{ - -namespace detail -{ - -inline void yield( unsigned k ) -{ - if( k < 4 ) - { - } -#if defined( BOOST_SMT_PAUSE ) - else if( k < 16 ) - { - BOOST_SMT_PAUSE - } -#endif - else if( k < 32 || k & 1 ) + if( k == 0 ) { - sched_yield(); + sp_thread_pause(); } else { - // g++ -Wextra warns on {} or {0} - struct timespec rqtp = { 0, 0 }; - - // POSIX says that timespec has tv_sec and tv_nsec - // But it doesn't guarantee order or placement - - rqtp.tv_sec = 0; - rqtp.tv_nsec = 1000; - - nanosleep( &rqtp, 0 ); + sp_thread_sleep(); } } @@ -156,22 +48,4 @@ inline void yield( unsigned k ) } // namespace boost -#else - -namespace boost -{ - -namespace detail -{ - -inline void yield( unsigned ) -{ -} - -} // namespace detail - -} // namespace boost - -#endif - #endif // #ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ptr.hpp index 0ab075d367..ef682df96c 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ptr.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ptr.hpp @@ -16,7 +16,7 @@ #include <boost/config.hpp> #include <boost/assert.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <boost/smart_ptr/detail/sp_convertible.hpp> #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> @@ -297,6 +297,8 @@ template<class T> T * get_pointer(intrusive_ptr<T> const & p) BOOST_SP_NOEXCEPT return p.get(); } +// pointer casts + template<class T, class U> intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U> const & p) { return static_cast<T *>(p.get()); @@ -312,6 +314,31 @@ template<class T, class U> intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U return dynamic_cast<T *>(p.get()); } +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +template<class T, class U> intrusive_ptr<T> static_pointer_cast( intrusive_ptr<U> && p ) BOOST_SP_NOEXCEPT +{ + return intrusive_ptr<T>( static_cast<T*>( p.detach() ), false ); +} + +template<class T, class U> intrusive_ptr<T> const_pointer_cast( intrusive_ptr<U> && p ) BOOST_SP_NOEXCEPT +{ + return intrusive_ptr<T>( const_cast<T*>( p.detach() ), false ); +} + +template<class T, class U> intrusive_ptr<T> dynamic_pointer_cast( intrusive_ptr<U> && p ) BOOST_SP_NOEXCEPT +{ + T * p2 = dynamic_cast<T*>( p.get() ); + + intrusive_ptr<T> r( p2, false ); + + if( p2 ) p.detach(); + + return r; +} + +#endif // defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + // operator<< #if !defined(BOOST_NO_IOSTREAM) @@ -358,4 +385,23 @@ template< class T > std::size_t hash_value( boost::intrusive_ptr<T> const & p ) } // namespace boost +// std::hash + +#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + +namespace std +{ + +template<class T> struct hash< ::boost::intrusive_ptr<T> > +{ + std::size_t operator()( ::boost::intrusive_ptr<T> const & p ) const BOOST_SP_NOEXCEPT + { + return std::hash< T* >()( p.get() ); + } +}; + +} // namespace std + +#endif // #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + #endif // #ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_array.hpp index 2eaf4db71b..785eb875fc 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_array.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_array.hpp @@ -1,5 +1,5 @@ /* -Copyright 2012-2017 Glen Joseph Fernandes +Copyright 2012-2019 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. @@ -8,57 +8,57 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP #define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP +#include <boost/core/default_allocator.hpp> #include <boost/smart_ptr/allocate_shared_array.hpp> namespace boost { template<class T> -inline typename detail::sp_if_size_array<T>::type +inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type make_shared() { - return boost::allocate_shared<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>()); + return boost::allocate_shared<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>()); } template<class T> -inline typename detail::sp_if_size_array<T>::type -make_shared(const typename detail::sp_array_element<T>::type& value) +inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type +make_shared(const typename remove_extent<T>::type& value) { - return boost::allocate_shared<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>(), value); + return boost::allocate_shared<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>(), value); } template<class T> -inline typename detail::sp_if_array<T>::type +inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type make_shared(std::size_t size) { - return boost::allocate_shared<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>(), size); + return boost::allocate_shared<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>(), size); } template<class T> -inline typename detail::sp_if_array<T>::type -make_shared(std::size_t size, - const typename detail::sp_array_element<T>::type& value) +inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type +make_shared(std::size_t size, const typename remove_extent<T>::type& value) { - return boost::allocate_shared<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>(), size, value); + return boost::allocate_shared<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>(), size, value); } template<class T> -inline typename detail::sp_if_size_array<T>::type +inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type make_shared_noinit() { - return allocate_shared_noinit<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>()); + return boost::allocate_shared_noinit<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>()); } template<class T> -inline typename detail::sp_if_array<T>::type +inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type make_shared_noinit(std::size_t size) { - return allocate_shared_noinit<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>(), size); + return boost::allocate_shared_noinit<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>(), size); } } /* boost */ diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_object.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_object.hpp index c681602dca..d726ec3054 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_object.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_object.hpp @@ -187,7 +187,7 @@ template< class T > struct sp_if_not_array< T[] > { }; -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) +#if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) template< class T, std::size_t N > struct sp_if_not_array< T[N] > { diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_unique.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_unique.hpp index eed503392b..1834007872 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_unique.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_unique.hpp @@ -1,5 +1,5 @@ /* -Copyright 2012-2015 Glen Joseph Fernandes +Copyright 2012-2019 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. @@ -8,59 +8,18 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_SMART_PTR_MAKE_UNIQUE_HPP #define BOOST_SMART_PTR_MAKE_UNIQUE_HPP -#include <boost/config.hpp> +#include <boost/type_traits/enable_if.hpp> +#include <boost/type_traits/is_array.hpp> +#include <boost/type_traits/is_unbounded_array.hpp> +#include <boost/type_traits/remove_extent.hpp> +#include <boost/type_traits/remove_reference.hpp> #include <memory> #include <utility> namespace boost { -namespace detail { template<class T> -struct up_if_object { - typedef std::unique_ptr<T> type; -}; - -template<class T> -struct up_if_object<T[]> { }; - -template<class T, std::size_t N> -struct up_if_object<T[N]> { }; - -template<class T> -struct up_if_array { }; - -template<class T> -struct up_if_array<T[]> { - typedef std::unique_ptr<T[]> type; -}; - -template<class T> -struct up_remove_reference { - typedef T type; -}; - -template<class T> -struct up_remove_reference<T&> { - typedef T type; -}; - -template<class T> -struct up_remove_reference<T&&> { - typedef T type; -}; - -template<class T> -struct up_element { }; - -template<class T> -struct up_element<T[]> { - typedef T type; -}; - -} /* detail */ - -template<class T> -inline typename detail::up_if_object<T>::type +inline typename enable_if_<!is_array<T>::value, std::unique_ptr<T> >::type make_unique() { return std::unique_ptr<T>(new T()); @@ -68,7 +27,7 @@ make_unique() #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template<class T, class... Args> -inline typename detail::up_if_object<T>::type +inline typename enable_if_<!is_array<T>::value, std::unique_ptr<T> >::type make_unique(Args&&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); @@ -76,33 +35,33 @@ make_unique(Args&&... args) #endif template<class T> -inline typename detail::up_if_object<T>::type -make_unique(typename detail::up_remove_reference<T>::type&& value) +inline typename enable_if_<!is_array<T>::value, std::unique_ptr<T> >::type +make_unique(typename remove_reference<T>::type&& value) { return std::unique_ptr<T>(new T(std::move(value))); } template<class T> -inline typename detail::up_if_object<T>::type +inline typename enable_if_<!is_array<T>::value, std::unique_ptr<T> >::type make_unique_noinit() { return std::unique_ptr<T>(new T); } template<class T> -inline typename detail::up_if_array<T>::type +inline typename enable_if_<is_unbounded_array<T>::value, + std::unique_ptr<T> >::type make_unique(std::size_t size) { - return std::unique_ptr<T>(new typename - detail::up_element<T>::type[size]()); + return std::unique_ptr<T>(new typename remove_extent<T>::type[size]()); } template<class T> -inline typename detail::up_if_array<T>::type +inline typename enable_if_<is_unbounded_array<T>::value, + std::unique_ptr<T> >::type make_unique_noinit(std::size_t size) { - return std::unique_ptr<T>(new typename - detail::up_element<T>::type[size]); + return std::unique_ptr<T>(new typename remove_extent<T>::type[size]); } } /* boost */ diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_array.hpp index 05dd05aea8..d56112cfa0 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_array.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_array.hpp @@ -16,7 +16,7 @@ #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <cstddef> // for std::ptrdiff_t diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_ptr.hpp index 5325eba5ff..9cf9566e01 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_ptr.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_ptr.hpp @@ -16,7 +16,7 @@ #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> #include <boost/smart_ptr/detail/sp_disable_deprecated.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #ifndef BOOST_NO_AUTO_PTR # include <memory> // for std::auto_ptr diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_array.hpp index 3ffa7426c3..c91b71f0f8 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_array.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_array.hpp @@ -25,7 +25,7 @@ #include <boost/smart_ptr/detail/shared_count.hpp> #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <cstddef> // for std::ptrdiff_t #include <algorithm> // for std::swap @@ -225,7 +225,7 @@ public: pn.swap(other.pn); } - void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + void * _internal_get_deleter( boost::detail::sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT { return pn.get_deleter( ti ); } @@ -285,7 +285,7 @@ template<class T> void swap(shared_array<T> & a, shared_array<T> & b) BOOST_SP_N template< class D, class T > D * get_deleter( shared_array<T> const & p ) BOOST_SP_NOEXCEPT { - return static_cast< D * >( p._internal_get_deleter( BOOST_SP_TYPEID(D) ) ); + return static_cast< D * >( p._internal_get_deleter( BOOST_SP_TYPEID_(D) ) ); } } // namespace boost diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_ptr.hpp index 4ac0699ef6..386ac099c6 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_ptr.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_ptr.hpp @@ -14,23 +14,16 @@ // See http://www.boost.org/libs/smart_ptr/ for documentation. // -#include <boost/config.hpp> // for broken compiler workarounds - -// In order to avoid circular dependencies with Boost.TR1 -// we make sure that our include of <memory> doesn't try to -// pull in the TR1 headers: that's why we use this header -// rather than including <memory> directly: -#include <boost/config/no_tr1/memory.hpp> // std::auto_ptr - -#include <boost/assert.hpp> -#include <boost/checked_delete.hpp> -#include <boost/throw_exception.hpp> #include <boost/smart_ptr/detail/shared_count.hpp> -#include <boost/detail/workaround.hpp> #include <boost/smart_ptr/detail/sp_convertible.hpp> #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> #include <boost/smart_ptr/detail/sp_disable_deprecated.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> +#include <boost/checked_delete.hpp> +#include <boost/throw_exception.hpp> +#include <boost/assert.hpp> +#include <boost/config.hpp> +#include <boost/config/workaround.hpp> #if !defined(BOOST_SP_NO_ATOMIC_ACCESS) #include <boost/smart_ptr/detail/spinlock_pool.hpp> @@ -40,6 +33,7 @@ #include <functional> // for std::less #include <typeinfo> // for std::bad_cast #include <cstddef> // for std::size_t +#include <memory> // for std::auto_ptr #if !defined(BOOST_NO_IOSTREAM) #if !defined(BOOST_NO_IOSFWD) @@ -86,7 +80,7 @@ template< class T > struct sp_element< T[] > typedef T type; }; -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) +#if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) template< class T, std::size_t N > struct sp_element< T[N] > { @@ -135,7 +129,7 @@ template< class T > struct sp_dereference< T[] > typedef void type; }; -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) +#if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) template< class T, std::size_t N > struct sp_dereference< T[N] > { @@ -160,7 +154,7 @@ template< class T > struct sp_member_access< T[] > typedef void type; }; -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) +#if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) template< class T, std::size_t N > struct sp_member_access< T[N] > { @@ -185,7 +179,7 @@ template< class T > struct sp_array_access< T[] > typedef T & type; }; -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) +#if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) template< class T, std::size_t N > struct sp_array_access< T[N] > { @@ -380,39 +374,81 @@ public: } // - // Requirements: D's copy constructor must not throw + // Requirements: D's copy/move constructors must not throw // // shared_ptr will release p by calling d(p) // +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template<class Y, class D> shared_ptr( Y * p, D d ): px( p ), pn( p, static_cast< D&& >( d ) ) + { + boost::detail::sp_deleter_construct( this, p ); + } + +#else + template<class Y, class D> shared_ptr( Y * p, D d ): px( p ), pn( p, d ) { boost::detail::sp_deleter_construct( this, p ); } +#endif + #if !defined( BOOST_NO_CXX11_NULLPTR ) +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template<class D> shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, static_cast< D&& >( d ) ) + { + } + +#else + template<class D> shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d ) { } #endif +#endif + // As above, but with allocator. A's copy constructor shall not throw. +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, static_cast< D&& >( d ), a ) + { + boost::detail::sp_deleter_construct( this, p ); + } + +#else + template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a ) { boost::detail::sp_deleter_construct( this, p ); } +#endif + #if !defined( BOOST_NO_CXX11_NULLPTR ) +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, static_cast< D&& >( d ), a ) + { + } + +#else + template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a ) { } #endif +#endif + // generated copy constructor, destructor are fine... #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) @@ -699,6 +735,20 @@ public: this_type( p ).swap( *this ); } +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template<class Y, class D> void reset( Y * p, D d ) + { + this_type( p, static_cast< D&& >( d ) ).swap( *this ); + } + + template<class Y, class D, class A> void reset( Y * p, D d, A a ) + { + this_type( p, static_cast< D&& >( d ), a ).swap( *this ); + } + +#else + template<class Y, class D> void reset( Y * p, D d ) { this_type( p, d ).swap( *this ); @@ -709,6 +759,8 @@ public: this_type( p, d, a ).swap( *this ); } +#endif + template<class Y> void reset( shared_ptr<Y> const & r, element_type * p ) BOOST_SP_NOEXCEPT { this_type( r, p ).swap( *this ); @@ -777,12 +829,27 @@ public: return pn < rhs.pn; } - void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + template<class Y> bool owner_equals( shared_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn == rhs.pn; + } + + template<class Y> bool owner_equals( weak_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn == rhs.pn; + } + + std::size_t owner_hash_value() const BOOST_SP_NOEXCEPT + { + return pn.hash_value(); + } + + void * _internal_get_deleter( boost::detail::sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT { return pn.get_deleter( ti ); } - void * _internal_get_local_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + void * _internal_get_local_deleter( boost::detail::sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT { return pn.get_local_deleter( ti ); } @@ -797,7 +864,7 @@ public: return px == r.px && pn == r.pn; } - boost::detail::shared_count _internal_count() const BOOST_NOEXCEPT + boost::detail::shared_count _internal_count() const BOOST_SP_NOEXCEPT { return pn; } @@ -1008,7 +1075,7 @@ namespace detail template<class D, class T> D * basic_get_deleter( shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT { - return static_cast<D *>( p._internal_get_deleter(BOOST_SP_TYPEID(D)) ); + return static_cast<D *>( p._internal_get_deleter(BOOST_SP_TYPEID_(D)) ); } template<class D, class T> D * basic_get_local_deleter( D *, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT; @@ -1022,7 +1089,7 @@ private: public: - esft2_deleter_wrapper() + esft2_deleter_wrapper() BOOST_SP_NOEXCEPT { } @@ -1155,6 +1222,25 @@ template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p ) BOO } // namespace boost +// std::hash + +#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + +namespace std +{ + +template<class T> struct hash< ::boost::shared_ptr<T> > +{ + std::size_t operator()( ::boost::shared_ptr<T> const & p ) const BOOST_SP_NOEXCEPT + { + return std::hash< typename ::boost::shared_ptr<T>::element_type* >()( p.get() ); + } +}; + +} // namespace std + +#endif // #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + #include <boost/smart_ptr/detail/local_sp_deleter.hpp> namespace boost @@ -1165,16 +1251,23 @@ namespace detail template<class D, class T> D * basic_get_local_deleter( D *, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT { - return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter<D>) ) ); + return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID_(local_sp_deleter<D>) ) ); } template<class D, class T> D const * basic_get_local_deleter( D const *, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT { - return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter<D>) ) ); + return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID_(local_sp_deleter<D>) ) ); } } // namespace detail +#if defined(__cpp_deduction_guides) + +template<class T> shared_ptr( weak_ptr<T> ) -> shared_ptr<T>; +template<class T, class D> shared_ptr( std::unique_ptr<T, D> ) -> shared_ptr<T>; + +#endif + } // namespace boost #if defined( BOOST_SP_DISABLE_DEPRECATED ) diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/weak_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/weak_ptr.hpp index 54d9ef3781..16eea6777c 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/weak_ptr.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/weak_ptr.hpp @@ -13,10 +13,11 @@ // See http://www.boost.org/libs/smart_ptr/ for documentation. // -#include <memory> // boost.TR1 include order fix #include <boost/smart_ptr/detail/shared_count.hpp> #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> +#include <memory> +#include <cstddef> namespace boost { @@ -137,6 +138,23 @@ public: boost::detail::sp_assert_convertible< Y, T >(); } + // aliasing + template<class Y> weak_ptr(shared_ptr<Y> const & r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( r.pn ) + { + } + + template<class Y> weak_ptr(weak_ptr<Y> const & r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( r.pn ) + { + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template<class Y> weak_ptr(weak_ptr<Y> && r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( std::move( r.pn ) ) + { + } + +#endif + #if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300) template<class Y> @@ -194,6 +212,11 @@ public: return pn.empty(); } + bool empty() const BOOST_SP_NOEXCEPT // extension, not in std::weak_ptr + { + return pn.empty(); + } + void reset() BOOST_SP_NOEXCEPT { this_type().swap(*this); @@ -205,13 +228,6 @@ public: pn.swap(other.pn); } - template<typename Y> - void _internal_aliasing_assign(weak_ptr<Y> const & r, element_type * px2) BOOST_SP_NOEXCEPT - { - px = px2; - pn = r.pn; - } - template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT { return pn < rhs.pn; @@ -222,6 +238,21 @@ public: return pn < rhs.pn; } + template<class Y> bool owner_equals( weak_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn == rhs.pn; + } + + template<class Y> bool owner_equals( shared_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn == rhs.pn; + } + + std::size_t owner_hash_value() const BOOST_SP_NOEXCEPT + { + return pn.hash_value(); + } + // Tasteless as this may seem, making all members public allows member templates // to work in the absence of member template friends. (Matthew Langston) @@ -249,6 +280,46 @@ template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) BOOST_SP_NOEXCEPT a.swap(b); } +#if defined(__cpp_deduction_guides) + +template<class T> weak_ptr( shared_ptr<T> ) -> weak_ptr<T>; + +#endif + +// hash_value + +template< class T > std::size_t hash_value( boost::weak_ptr<T> const & p ) BOOST_SP_NOEXCEPT +{ + return p.owner_hash_value(); +} + } // namespace boost +// std::hash, std::equal_to + +namespace std +{ + +#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + +template<class T> struct hash< ::boost::weak_ptr<T> > +{ + std::size_t operator()( ::boost::weak_ptr<T> const & p ) const BOOST_SP_NOEXCEPT + { + return p.owner_hash_value(); + } +}; + +#endif // #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + +template<class T> struct equal_to< ::boost::weak_ptr<T> > +{ + bool operator()( ::boost::weak_ptr<T> const & a, ::boost::weak_ptr<T> const & b ) const BOOST_SP_NOEXCEPT + { + return a.owner_equals( b ); + } +}; + +} // namespace std + #endif // #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits/is_bounded_array.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_bounded_array.hpp new file mode 100644 index 0000000000..5aeca6f98e --- /dev/null +++ b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_bounded_array.hpp @@ -0,0 +1,42 @@ +/* +Copyright 2018 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under 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) +*/ + +#ifndef BOOST_TT_IS_BOUNDED_ARRAY_HPP_INCLUDED +#define BOOST_TT_IS_BOUNDED_ARRAY_HPP_INCLUDED + +#include <boost/type_traits/integral_constant.hpp> +#include <cstddef> + +namespace boost { + +template<class T> +struct is_bounded_array + : false_type { }; + +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +template<class T, std::size_t N> +struct is_bounded_array<T[N]> + : true_type { }; + +template<class T, std::size_t N> +struct is_bounded_array<const T[N]> + : true_type { }; + +template<class T, std::size_t N> +struct is_bounded_array<volatile T[N]> + : true_type { }; + +template<class T, std::size_t N> +struct is_bounded_array<const volatile T[N]> + : true_type { }; +#endif + +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits/is_unbounded_array.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_unbounded_array.hpp new file mode 100644 index 0000000000..1bacfdca1d --- /dev/null +++ b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_unbounded_array.hpp @@ -0,0 +1,41 @@ +/* +Copyright 2018 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under 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) +*/ + +#ifndef BOOST_TT_IS_UNBOUNDED_ARRAY_HPP_INCLUDED +#define BOOST_TT_IS_UNBOUNDED_ARRAY_HPP_INCLUDED + +#include <boost/type_traits/integral_constant.hpp> + +namespace boost { + +template<class T> +struct is_unbounded_array + : false_type { }; + +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +template<class T> +struct is_unbounded_array<T[]> + : true_type { }; + +template<class T> +struct is_unbounded_array<const T[]> + : true_type { }; + +template<class T> +struct is_unbounded_array<volatile T[]> + : true_type { }; + +template<class T> +struct is_unbounded_array<const volatile T[]> + : true_type { }; +#endif + +} /* boost */ + +#endif |