diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2024-08-22 11:55:08 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2024-08-22 12:10:37 +0300 |
commit | a04076863119aed8a4fd5d4b31b42f83283a2d8d (patch) | |
tree | 5e5ab3b65a88914055da22448d5fc4bf8f9d8f10 /contrib/restricted | |
parent | a0a2e8a8e48891e445f3a15fff6b54953563d9a0 (diff) | |
download | ydb-a04076863119aed8a4fd5d4b31b42f83283a2d8d.tar.gz |
Update contrib/restricted/boost/container to 1.86.0
1d9f36e4b2e11f3aabe2d7350166df08c1cc72d1
Diffstat (limited to 'contrib/restricted')
32 files changed, 854 insertions, 505 deletions
diff --git a/contrib/restricted/boost/container/include/boost/container/allocator_traits.hpp b/contrib/restricted/boost/container/include/boost/container/allocator_traits.hpp index cdb6683e88..dd5bf0e42d 100644 --- a/contrib/restricted/boost/container/include/boost/container/allocator_traits.hpp +++ b/contrib/restricted/boost/container/include/boost/container/allocator_traits.hpp @@ -32,6 +32,8 @@ #include <boost/container/detail/mpl.hpp> #include <boost/container/detail/type_traits.hpp> //is_empty #include <boost/container/detail/placement_new.hpp> +#include <boost/container/detail/is_pair.hpp> +#include <boost/container/detail/addressof.hpp> #ifndef BOOST_CONTAINER_DETAIL_STD_FWD_HPP #include <boost/container/detail/std_fwd.hpp> #endif @@ -47,9 +49,10 @@ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) +#if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-result" +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate @@ -73,7 +76,7 @@ #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 9 #include <boost/intrusive/detail/has_member_function_callable_with.hpp> -#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) +#if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) #pragma GCC diagnostic pop #endif @@ -81,6 +84,144 @@ namespace boost { namespace container { +namespace dtl { + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +template<class T, class ...Args> +BOOST_CONTAINER_FORCEINLINE void construct_type(T *p, BOOST_FWD_REF(Args) ...args) +{ + ::new((void*)p, boost_container_new_t()) T(::boost::forward<Args>(args)...); +} + +template < class Pair, class KeyType, class ... Args> +typename dtl::enable_if< dtl::is_pair<Pair>, void >::type +construct_type + (Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args) +{ + construct_type(dtl::addressof(p->first), ::boost::forward<KeyType>(k)); + BOOST_CONTAINER_TRY{ + construct_type(dtl::addressof(p->second), ::boost::forward<Args>(args)...); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename Pair::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + +#else + +#define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ(N) \ +template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N>\ +BOOST_CONTAINER_FORCEINLINE \ + typename dtl::disable_if_c<dtl::is_pair<T>::value, void >::type \ +construct_type(T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ +{\ + ::new((void*)p, boost_container_new_t()) T( BOOST_MOVE_FWD##N );\ +}\ +// +BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ) +#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ + +#define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE(N) \ +template < class Pair, class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N>\ +typename dtl::enable_if< dtl::is_pair<Pair>, void >::type construct_type\ + (Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ +{\ + construct_type(dtl::addressof(p->first), ::boost::forward<KeyType>(k));\ + BOOST_CONTAINER_TRY{\ + construct_type(dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + }\ + BOOST_CONTAINER_CATCH(...) {\ + typedef typename Pair::first_type first_type;\ + dtl::addressof(p->first)->~first_type();\ + BOOST_CONTAINER_RETHROW\ + }\ + BOOST_CONTAINER_CATCH_END\ +}\ +// +BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE) +#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE + +#endif + +template<class T> +inline +typename dtl::enable_if<dtl::is_pair<T>, void >::type +construct_type(T* p) +{ + dtl::construct_type(dtl::addressof(p->first)); + BOOST_CONTAINER_TRY{ + dtl::construct_type(dtl::addressof(p->second)); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename T::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + + +template<class T, class U> +inline +typename dtl::enable_if_c + < dtl::is_pair<T>::value + , void >::type +construct_type(T* p, U &u) +{ + dtl::construct_type(dtl::addressof(p->first), u.first); + BOOST_CONTAINER_TRY{ + dtl::construct_type(dtl::addressof(p->second), u.second); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename T::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + +template<class T, class U> +inline +typename dtl::enable_if_c + < dtl::is_pair<typename dtl::remove_reference<T>::type>::value && + !boost::move_detail::is_reference<U>::value //This is needed for MSVC10 and ambiguous overloads + , void >::type +construct_type(T* p, BOOST_RV_REF(U) u) +{ + dtl::construct_type(dtl::addressof(p->first), ::boost::move(u.first)); + BOOST_CONTAINER_TRY{ + dtl::construct_type(dtl::addressof(p->second), ::boost::move(u.second)); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename T::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + +template<class T, class U, class V> +inline +typename dtl::enable_if<dtl::is_pair<T>, void >::type +construct_type(T* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) +{ + dtl::construct_type(dtl::addressof(p->first), ::boost::forward<U>(x)); + BOOST_CONTAINER_TRY{ + dtl::construct_type(dtl::addressof(p->second), ::boost::forward<V>(y)); + } + BOOST_CONTAINER_CATCH(...) { + typedef typename T::first_type first_type; + dtl::addressof(p->first)->~first_type(); + BOOST_CONTAINER_RETHROW + } + BOOST_CONTAINER_CATCH_END +} + +} //namespace dtl #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -100,19 +241,19 @@ namespace dtl { //supporting rvalue references template<class Allocator> struct is_std_allocator -{ static const bool value = false; }; +{ BOOST_STATIC_CONSTEXPR bool value = false; }; template<class T> struct is_std_allocator< std::allocator<T> > -{ static const bool value = true; }; +{ BOOST_STATIC_CONSTEXPR bool value = true; }; template<class T, class Options> struct is_std_allocator< small_vector_allocator<T, std::allocator<T>, Options > > -{ static const bool value = true; }; +{ BOOST_STATIC_CONSTEXPR bool value = true; }; template<class Allocator> struct is_not_std_allocator -{ static const bool value = !is_std_allocator<Allocator>::value; }; +{ BOOST_STATIC_CONSTEXPR bool value = !is_std_allocator<Allocator>::value; }; BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer) BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_pointer) @@ -358,7 +499,7 @@ struct allocator_traits template <class T, class ...Args> inline static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args) { - static const bool value = ::boost::move_detail::and_ + BOOST_STATIC_CONSTEXPR bool value = ::boost::move_detail::and_ < dtl::is_not_std_allocator<Allocator> , boost::container::dtl::has_member_function_callable_with_construct < Allocator, T*, Args... > @@ -419,7 +560,7 @@ struct allocator_traits template<class T, class ...Args> inline static void priv_construct(dtl::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) - { ::new((void*)p, boost_container_new_t()) T(::boost::forward<Args>(args)...); } + { dtl::construct_type(p, ::boost::forward<Args>(args)...); } #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) public: @@ -427,7 +568,7 @@ struct allocator_traits template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ inline static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ - static const bool value = ::boost::move_detail::and_ \ + BOOST_STATIC_CONSTEXPR bool value = ::boost::move_detail::and_ \ < dtl::is_not_std_allocator<Allocator> \ , boost::container::dtl::has_member_function_callable_with_construct \ < Allocator, T* BOOST_MOVE_I##N BOOST_MOVE_FWD_T##N > \ @@ -450,7 +591,7 @@ struct allocator_traits \ template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ inline static void priv_construct(dtl::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - { ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\ + { dtl::construct_type(p BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ // BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL) #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL diff --git a/contrib/restricted/boost/container/include/boost/container/container_fwd.hpp b/contrib/restricted/boost/container/include/boost/container/container_fwd.hpp index 9e82fdef66..2525b7d28f 100644 --- a/contrib/restricted/boost/container/include/boost/container/container_fwd.hpp +++ b/contrib/restricted/boost/container/include/boost/container/container_fwd.hpp @@ -15,6 +15,8 @@ # include <boost/config.hpp> #endif +#include <boost/container/detail/workaround.hpp> + #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -277,10 +279,10 @@ class basic_string; typedef basic_string <char> string; typedef basic_string<wchar_t> wstring; -static const std::size_t ADP_nodes_per_block = 256u; -static const std::size_t ADP_max_free_blocks = 2u; -static const std::size_t ADP_overhead_percent = 1u; -static const std::size_t ADP_only_alignment = 0u; +BOOST_STATIC_CONSTEXPR std::size_t ADP_nodes_per_block = 256u; +BOOST_STATIC_CONSTEXPR std::size_t ADP_max_free_blocks = 2u; +BOOST_STATIC_CONSTEXPR std::size_t ADP_overhead_percent = 1u; +BOOST_STATIC_CONSTEXPR std::size_t ADP_only_alignment = 0u; template < class T , std::size_t NodesPerBlock = ADP_nodes_per_block @@ -295,7 +297,7 @@ template < class T , unsigned int AllocationDisableMask = 0> class allocator; -static const std::size_t NodeAlloc_nodes_per_block = 256u; +BOOST_STATIC_CONSTEXPR std::size_t NodeAlloc_nodes_per_block = 256u; template < class T @@ -332,7 +334,7 @@ struct ordered_range_t //! Value used to tag that the input range is //! guaranteed to be ordered -static const ordered_range_t ordered_range = ordered_range_t(); +BOOST_CONTAINER_CONSTANT_VAR ordered_range_t ordered_range = ordered_range_t(); //! Type used to tag that the input range is //! guaranteed to be ordered and unique @@ -342,7 +344,7 @@ struct ordered_unique_range_t //! Value used to tag that the input range is //! guaranteed to be ordered and unique -static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); +BOOST_CONTAINER_CONSTANT_VAR ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); //! Type used to tag that the inserted values //! should be default initialized @@ -351,7 +353,7 @@ struct default_init_t //! Value used to tag that the inserted values //! should be default initialized -static const default_init_t default_init = default_init_t(); +BOOST_CONTAINER_CONSTANT_VAR default_init_t default_init = default_init_t(); #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED //! Type used to tag that the inserted values @@ -361,7 +363,7 @@ struct value_init_t //! Value used to tag that the inserted values //! should be value initialized -static const value_init_t value_init = value_init_t(); +BOOST_CONTAINER_CONSTANT_VAR value_init_t value_init = value_init_t(); namespace container_detail_really_deep_namespace { diff --git a/contrib/restricted/boost/container/include/boost/container/detail/advanced_insert_int.hpp b/contrib/restricted/boost/container/include/boost/container/detail/advanced_insert_int.hpp index bc6801adb4..e16082a741 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/advanced_insert_int.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/advanced_insert_int.hpp @@ -39,6 +39,7 @@ #include <boost/move/utility_core.hpp> #include <boost/move/detail/force_ptr.hpp> +#include <boost/move/detail/launder.hpp> // other #include <boost/assert.hpp> @@ -138,8 +139,8 @@ struct insert_value_initialized_n_proxy while (n){ --n; storage_t v; - alloc_traits::construct(a, move_detail::force_ptr<value_type *>(&v)); - value_type *vp = move_detail::force_ptr<value_type *>(&v); + alloc_traits::construct(a, (value_type*)&v); + value_type *vp = move_detail::launder_cast<value_type *>(&v); value_destructor<Allocator> on_exit(a, *vp); (void)on_exit; *p = ::boost::move(*vp); ++p; @@ -165,8 +166,8 @@ struct insert_default_initialized_n_proxy while (n){ --n; typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v; - alloc_traits::construct(a, move_detail::force_ptr<value_type *>(&v), default_init); - value_type *vp = move_detail::force_ptr<value_type *>(&v); + alloc_traits::construct(a, (value_type*)&v, default_init); + value_type *vp = move_detail::launder_cast<value_type *>(&v); value_destructor<Allocator> on_exit(a, *vp); (void)on_exit; *p = ::boost::move(*vp); ++p; @@ -181,7 +182,7 @@ struct insert_copy_proxy typedef boost::container::allocator_traits<Allocator> alloc_traits; typedef typename alloc_traits::value_type value_type; - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_copy_proxy(const value_type &v) : v_(v) @@ -211,7 +212,7 @@ struct insert_move_proxy typedef boost::container::allocator_traits<Allocator> alloc_traits; typedef typename alloc_traits::value_type value_type; - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_move_proxy(value_type &v) : v_(v) @@ -264,7 +265,7 @@ struct insert_nonmovable_emplace_proxy typedef typename alloc_traits::value_type value_type; typedef typename build_number_seq<sizeof...(Args)>::type index_tuple_t; - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_nonmovable_emplace_proxy(BOOST_FWD_REF(Args)... args) : args_(args...) @@ -295,7 +296,7 @@ struct insert_emplace_proxy typedef typename base_t::value_type value_type; typedef typename base_t::index_tuple_t index_tuple_t; - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy(BOOST_FWD_REF(Args)... args) : base_t(::boost::forward<Args>(args)...) @@ -312,8 +313,8 @@ struct insert_emplace_proxy { BOOST_ASSERT(n ==1); (void)n; typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v; - alloc_traits::construct(a, move_detail::force_ptr<value_type *>(&v), ::boost::forward<Args>(get<IdxPack>(this->args_))...); - value_type *vp = move_detail::force_ptr<value_type *>(&v); + alloc_traits::construct(a, (value_type*)&v, ::boost::forward<Args>(get<IdxPack>(this->args_))...); + value_type *vp = move_detail::launder_cast<value_type *>(&v); BOOST_CONTAINER_TRY{ *p = ::boost::move(*vp); } @@ -331,7 +332,7 @@ template<class Allocator> struct insert_emplace_proxy<Allocator, typename boost::container::allocator_traits<Allocator>::value_type> : public insert_move_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy(typename boost::container::allocator_traits<Allocator>::value_type &&v) : insert_move_proxy<Allocator>(v) @@ -348,7 +349,7 @@ struct insert_emplace_proxy<Allocator : public insert_copy_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy(const typename boost::container::allocator_traits<Allocator>::value_type &v) : insert_copy_proxy<Allocator>(v) @@ -359,7 +360,7 @@ template<class Allocator> struct insert_emplace_proxy<Allocator, typename boost::container::allocator_traits<Allocator>::value_type &> : public insert_copy_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy(const typename boost::container::allocator_traits<Allocator>::value_type &v) : insert_copy_proxy<Allocator>(v) @@ -372,7 +373,7 @@ struct insert_emplace_proxy<Allocator > : public insert_copy_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy(const typename boost::container::allocator_traits<Allocator>::value_type &v) : insert_copy_proxy<Allocator>(v) @@ -396,7 +397,7 @@ struct insert_nonmovable_emplace_proxy##N\ typedef boost::container::allocator_traits<Allocator> alloc_traits;\ typedef typename alloc_traits::value_type value_type;\ \ - static const bool single_value = true;\ + BOOST_STATIC_CONSTEXPR bool single_value = true;\ \ inline explicit insert_nonmovable_emplace_proxy##N(BOOST_MOVE_UREF##N)\ BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N {}\ @@ -425,7 +426,7 @@ struct insert_emplace_proxy_arg##N\ typedef typename base_t::value_type value_type;\ typedef boost::container::allocator_traits<Allocator> alloc_traits;\ \ - static const bool single_value = true;\ + BOOST_STATIC_CONSTEXPR bool single_value = true;\ \ inline explicit insert_emplace_proxy_arg##N(BOOST_MOVE_UREF##N)\ : base_t(BOOST_MOVE_FWD##N){}\ @@ -435,8 +436,8 @@ struct insert_emplace_proxy_arg##N\ {\ BOOST_ASSERT(n == 1); (void)n;\ typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\ - alloc_traits::construct(a, move_detail::force_ptr<value_type *>(&v) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ - value_type *vp = move_detail::force_ptr<value_type *>(&v);\ + alloc_traits::construct(a, (value_type*)&v BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ + value_type *vp = move_detail::launder_cast<value_type *>(&v);\ BOOST_CONTAINER_TRY{\ *p = ::boost::move(*vp);\ }\ @@ -459,7 +460,7 @@ template<class Allocator> struct insert_emplace_proxy_arg1<Allocator, ::boost::rv<typename boost::container::allocator_traits<Allocator>::value_type> > : public insert_move_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits<Allocator>::value_type &v) : insert_move_proxy<Allocator>(v) @@ -470,7 +471,7 @@ template<class Allocator> struct insert_emplace_proxy_arg1<Allocator, typename boost::container::allocator_traits<Allocator>::value_type> : public insert_copy_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<Allocator>::value_type &v) : insert_copy_proxy<Allocator>(v) @@ -484,7 +485,7 @@ template<class Allocator> struct insert_emplace_proxy_arg1<Allocator, typename boost::container::allocator_traits<Allocator>::value_type> : public insert_move_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits<Allocator>::value_type &&v) : insert_move_proxy<Allocator>(v) @@ -500,7 +501,7 @@ struct insert_emplace_proxy_arg1<Allocator > : public insert_copy_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<Allocator>::value_type &v) : insert_copy_proxy<Allocator>(v) @@ -511,7 +512,7 @@ template<class Allocator> struct insert_emplace_proxy_arg1<Allocator, typename boost::container::allocator_traits<Allocator>::value_type &> : public insert_copy_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<Allocator>::value_type &v) : insert_copy_proxy<Allocator>(v) @@ -524,7 +525,7 @@ struct insert_emplace_proxy_arg1<Allocator > : public insert_copy_proxy<Allocator> { - static const bool single_value = true; + BOOST_STATIC_CONSTEXPR bool single_value = true; inline explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<Allocator>::value_type &v) : insert_copy_proxy<Allocator>(v) diff --git a/contrib/restricted/boost/container/include/boost/container/detail/allocation_type.hpp b/contrib/restricted/boost/container/include/boost/container/detail/allocation_type.hpp index 1e8aa67310..5f0d4b62b6 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/allocation_type.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/allocation_type.hpp @@ -42,13 +42,13 @@ enum allocation_type_v typedef unsigned int allocation_type; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -static const allocation_type allocate_new = (allocation_type)allocate_new_v; -static const allocation_type expand_fwd = (allocation_type)expand_fwd_v; -static const allocation_type expand_bwd = (allocation_type)expand_bwd_v; -static const allocation_type shrink_in_place = (allocation_type)shrink_in_place_v; -static const allocation_type try_shrink_in_place= (allocation_type)try_shrink_in_place_v; -static const allocation_type nothrow_allocation = (allocation_type)nothrow_allocation_v; -static const allocation_type zero_memory = (allocation_type)zero_memory_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type allocate_new = (allocation_type)allocate_new_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type expand_fwd = (allocation_type)expand_fwd_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type expand_bwd = (allocation_type)expand_bwd_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type shrink_in_place = (allocation_type)shrink_in_place_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type try_shrink_in_place= (allocation_type)try_shrink_in_place_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type nothrow_allocation = (allocation_type)nothrow_allocation_v; +BOOST_CONTAINER_CONSTANT_VAR allocation_type zero_memory = (allocation_type)zero_memory_v; } //namespace container { } //namespace boost { diff --git a/contrib/restricted/boost/container/include/boost/container/detail/block_list.hpp b/contrib/restricted/boost/container/include/boost/container/detail/block_list.hpp index 0ed0e2279a..4852326788 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/block_list.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/block_list.hpp @@ -74,11 +74,11 @@ class block_list_base { list_node m_list; - static const std::size_t MaxAlignMinus1 = memory_resource::max_align-1u; + BOOST_STATIC_CONSTEXPR std::size_t MaxAlignMinus1 = memory_resource::max_align-1u; public: - static const std::size_t header_size = std::size_t(sizeof(DerivedFromBlockListHeader) + MaxAlignMinus1) & std::size_t(~MaxAlignMinus1); + BOOST_STATIC_CONSTEXPR std::size_t header_size = std::size_t(sizeof(DerivedFromBlockListHeader) + MaxAlignMinus1) & std::size_t(~MaxAlignMinus1); explicit block_list_base() { list_algo::init_header(&m_list); } diff --git a/contrib/restricted/boost/container/include/boost/container/detail/block_slist.hpp b/contrib/restricted/boost/container/include/boost/container/detail/block_slist.hpp index 890e72588e..b265ba44c5 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/block_slist.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/block_slist.hpp @@ -68,11 +68,11 @@ class block_slist_base { slist_node m_slist; - static const std::size_t MaxAlignMinus1 = memory_resource::max_align-1u; + BOOST_STATIC_CONSTEXPR std::size_t MaxAlignMinus1 = memory_resource::max_align-1u; public: - static const std::size_t header_size = std::size_t(sizeof(DerivedFromBlockSlistHeader) + MaxAlignMinus1) & std::size_t(~MaxAlignMinus1); + BOOST_STATIC_CONSTEXPR std::size_t header_size = std::size_t(sizeof(DerivedFromBlockSlistHeader) + MaxAlignMinus1) & std::size_t(~MaxAlignMinus1); explicit block_slist_base() { slist_algo::init_header(&m_slist); } diff --git a/contrib/restricted/boost/container/include/boost/container/detail/construct_in_place.hpp b/contrib/restricted/boost/container/include/boost/container/detail/construct_in_place.hpp index d824d814af..bfdf05c2e1 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/construct_in_place.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/construct_in_place.hpp @@ -24,6 +24,7 @@ #include <boost/container/allocator_traits.hpp> #include <boost/container/detail/iterators.hpp> #include <boost/container/detail/value_init.hpp> +#include <boost/container/detail/is_pair.hpp> namespace boost { namespace container { @@ -62,9 +63,42 @@ BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, empla //Assignment +template<class T, class U> +BOOST_CONTAINER_FORCEINLINE + typename dtl::disable_if_c + < dtl::is_pair<typename dtl::remove_reference<T>::type>::value + && dtl::is_pair<typename dtl::remove_reference<U>::type>::value + , void>::type +assign_in_place_ref(T &t, BOOST_FWD_REF(U) u) +{ t = ::boost::forward<U>(u); } + +template<class T, class U> +BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_c + < dtl::is_pair<typename dtl::remove_reference<T>::type>::value + && dtl::is_pair<typename dtl::remove_reference<U>::type>::value + , void>::type +assign_in_place_ref(T &t, const U &u) +{ + assign_in_place_ref(t.first, u.first); + assign_in_place_ref(t.second, u.second); +} + +template<class T, class U> +BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_c + < dtl::is_pair<typename dtl::remove_reference<T>::type>::value + && dtl::is_pair<typename dtl::remove_reference<U>::type>::value + , void>::type +assign_in_place_ref(T &t, BOOST_RV_REF(U) u) +{ + assign_in_place_ref(t.first, ::boost::move(u.first)); + assign_in_place_ref(t.second, ::boost::move(u.second)); +} + template<class DstIt, class InpIt> BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source) -{ *dest = *source; } +{ assign_in_place_ref(*dest, *source); } template<class DstIt, class U> BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator<U>) diff --git a/contrib/restricted/boost/container/include/boost/container/detail/copy_move_algo.hpp b/contrib/restricted/boost/container/include/boost/container/detail/copy_move_algo.hpp index 105faf606d..7c7d216feb 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/copy_move_algo.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/copy_move_algo.hpp @@ -50,7 +50,7 @@ # pragma GCC diagnostic ignored "-Wstringop-overflow" # endif //GCC 12 seems a bit confused about array access error with small_vector -# if defined(BOOST_GCC) && ((BOOST_GCC >= 120000) && (BOOST_GCC < 130000)) +# if defined(BOOST_GCC) && (BOOST_GCC >= 110000) # pragma GCC diagnostic ignored "-Wstringop-overread" # pragma GCC diagnostic ignored "-Wstringop-overflow" # endif @@ -64,7 +64,7 @@ namespace dtl { template<class I> struct are_elements_contiguous { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; ///////////////////////// @@ -74,7 +74,7 @@ struct are_elements_contiguous template<class T> struct are_elements_contiguous<T*> { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; ///////////////////////// @@ -115,7 +115,7 @@ namespace dtl { template <class Pointer, bool IsConst> struct are_elements_contiguous<boost::container::vec_iterator<Pointer, IsConst> > { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; @@ -126,7 +126,7 @@ struct are_elements_contiguous<boost::container::vec_iterator<Pointer, IsConst> template <class PointedType, class DifferenceType, class OffsetType, std::size_t OffsetAlignment> struct are_elements_contiguous< ::boost::interprocess::offset_ptr<PointedType, DifferenceType, OffsetType, OffsetAlignment> > { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template <typename I, typename O> @@ -185,20 +185,20 @@ private: template <class U> static two test(int, ...); template <class U> static char test(int, const wrapper<U::single_value>*); public: - static const bool value = sizeof(test<T>(0, 0)) == 1; + BOOST_STATIC_CONSTEXPR bool value = sizeof(test<T>(0, 0)) == 1; void dummy() {} }; template<class InsertionProxy, bool = has_single_value<InsertionProxy>::value> struct is_single_value_proxy_impl { - static const bool value = InsertionProxy::single_value; + BOOST_STATIC_CONSTEXPR bool value = InsertionProxy::single_value; }; template<class InsertionProxy> struct is_single_value_proxy_impl<InsertionProxy, false> { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template<class InsertionProxy> @@ -293,7 +293,7 @@ template <typename O> struct is_memzero_initializable { typedef typename ::boost::container::iterator_traits<O>::value_type value_type; - static const bool value = are_elements_contiguous<O>::value && + BOOST_STATIC_CONSTEXPR bool value = are_elements_contiguous<O>::value && ( dtl::is_integral<value_type>::value || dtl::is_enum<value_type>::value #if defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL) || dtl::is_pointer<value_type>::value @@ -1111,7 +1111,7 @@ inline typename dtl::disable_if_memtransfer_copy_assignable<F, G, void>::type boost::container::destroy_alloc_n(a, large_range_f, std::size_t(n_j - n_i)); } -static const std::size_t DeepSwapAllocNMaxStorage = std::size_t(1) << std::size_t(11); //2K bytes +BOOST_CONTAINER_CONSTANT_VAR std::size_t DeepSwapAllocNMaxStorage = std::size_t(1) << std::size_t(11); //2K bytes template <std::size_t MaxTmpBytes @@ -1496,8 +1496,8 @@ void expand_backward_forward_and_insert_alloc_move_backward { typedef std::size_t size_type; typedef typename allocator_traits<Allocator>::value_type value_type; - static const bool trivial_dctr_after_move = has_trivial_destructor_after_move<value_type>::value; - static const bool trivial_dctr = dtl::is_trivially_destructible<value_type>::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr_after_move = has_trivial_destructor_after_move<value_type>::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr = dtl::is_trivially_destructible<value_type>::value; typedef typename dtl::if_c <trivial_dctr @@ -1796,8 +1796,8 @@ inline void expand_backward_forward_and_insert_alloc_move_forward { typedef std::size_t size_type; typedef typename allocator_traits<Allocator>::value_type value_type; - static const bool trivial_dctr_after_move = has_trivial_destructor_after_move<value_type>::value; - static const bool trivial_dctr = dtl::is_trivially_destructible<value_type>::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr_after_move = has_trivial_destructor_after_move<value_type>::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr = dtl::is_trivially_destructible<value_type>::value; typedef typename dtl::if_c <trivial_dctr diff --git a/contrib/restricted/boost/container/include/boost/container/detail/dispatch_uses_allocator.hpp b/contrib/restricted/boost/container/include/boost/container/detail/dispatch_uses_allocator.hpp index 5bb7687d5a..343c512c79 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/dispatch_uses_allocator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/dispatch_uses_allocator.hpp @@ -62,7 +62,7 @@ namespace dtl { template<class X> static no_type test(...); - static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); + BOOST_STATIC_CONSTEXPR bool value = sizeof(test<T>(0)) == sizeof(yes_type); }; template <class T, class InnerAlloc, class ...Args> diff --git a/contrib/restricted/boost/container/include/boost/container/detail/is_pair.hpp b/contrib/restricted/boost/container/include/boost/container/detail/is_pair.hpp index 239e36e114..ddb63b68ff 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/is_pair.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/is_pair.hpp @@ -61,25 +61,25 @@ struct pair; template <class T> struct is_pair { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template <class T1, class T2> struct is_pair< pair<T1, T2> > { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template <class T1, class T2> struct is_pair< std::pair<T1, T2> > { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template <class T> struct is_not_pair { - static const bool value = !is_pair<T>::value; + BOOST_STATIC_CONSTEXPR bool value = !is_pair<T>::value; }; } //namespace dtl { diff --git a/contrib/restricted/boost/container/include/boost/container/detail/iterators.hpp b/contrib/restricted/boost/container/include/boost/container/detail/iterators.hpp index 57ffb0ced4..82daac4677 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/iterators.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/iterators.hpp @@ -723,50 +723,50 @@ struct has_iterator_category template <typename X> static two test(int, ...); - static const bool value = (1 == sizeof(test<T>(0, 0))); + BOOST_STATIC_CONSTEXPR bool value = (1 == sizeof(test<T>(0, 0))); }; template<class T, bool = has_iterator_category<T>::value > struct is_input_iterator { - static const bool value = is_same<typename T::iterator_category, std::input_iterator_tag>::value; + BOOST_STATIC_CONSTEXPR bool value = is_same<typename T::iterator_category, std::input_iterator_tag>::value; }; template<class T> struct is_input_iterator<T, false> { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template<class T> struct is_not_input_iterator { - static const bool value = !is_input_iterator<T>::value; + BOOST_STATIC_CONSTEXPR bool value = !is_input_iterator<T>::value; }; template<class T, bool = has_iterator_category<T>::value > struct is_forward_iterator { - static const bool value = is_same<typename T::iterator_category, std::forward_iterator_tag>::value; + BOOST_STATIC_CONSTEXPR bool value = is_same<typename T::iterator_category, std::forward_iterator_tag>::value; }; template<class T> struct is_forward_iterator<T, false> { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template<class T, bool = has_iterator_category<T>::value > struct is_bidirectional_iterator { - static const bool value = is_same<typename T::iterator_category, std::bidirectional_iterator_tag>::value; + BOOST_STATIC_CONSTEXPR bool value = is_same<typename T::iterator_category, std::bidirectional_iterator_tag>::value; }; template<class T> struct is_bidirectional_iterator<T, false> { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template<class IINodeType> diff --git a/contrib/restricted/boost/container/include/boost/container/detail/mpl.hpp b/contrib/restricted/boost/container/include/boost/container/detail/mpl.hpp index ffae180c85..7662e4cc64 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/mpl.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/mpl.hpp @@ -84,13 +84,13 @@ struct void_t { typedef void type; }; template <class T, class=void> struct is_transparent_base { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template <class T> struct is_transparent_base<T, typename void_t<typename T::is_transparent>::type> { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template <class T> @@ -112,7 +112,7 @@ template<typename...> using variadic_void_t = void; template<typename Allocator, typename = void> struct is_allocator { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template <typename T> @@ -123,7 +123,7 @@ struct is_allocator < Allocator, variadic_void_t< typename Allocator::value_type , decltype(ctad_declval<Allocator&>().allocate(size_t{})) >> { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template<class T> diff --git a/contrib/restricted/boost/container/include/boost/container/detail/multiallocation_chain.hpp b/contrib/restricted/boost/container/include/boost/container/detail/multiallocation_chain.hpp index 749ef5a0ad..fa58a00bb3 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/multiallocation_chain.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/multiallocation_chain.hpp @@ -25,15 +25,17 @@ #include <boost/container/container_fwd.hpp> // container/detail #include <boost/move/detail/to_raw_pointer.hpp> -#include <boost/container/detail/transform_iterator.hpp> #include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/placement_new.hpp> +#include <boost/container/detail/iterator.hpp> // intrusive #include <boost/intrusive/slist.hpp> #include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/detail/twin.hpp> // move #include <boost/move/utility_core.hpp> +#include <boost/move/detail/iterator_to_raw_pointer.hpp> + namespace boost { namespace container { @@ -187,15 +189,100 @@ class basic_multiallocation_chain } }; -template<class T> -struct cast_functor +template <class Iterator, class T> +class multialloc_iterator + : public boost::container::iterator + < typename Iterator::iterator_category + , T + , typename Iterator::difference_type + , T* + , T& + > { - typedef typename dtl::add_reference<T>::type result_type; - template<class U> - result_type operator()(U &ptr) const - { return *static_cast<T*>(static_cast<void*>(&ptr)); } + public: + inline explicit multialloc_iterator(const Iterator &it) + : m_it(it) + {} + + inline explicit multialloc_iterator() + : m_it() + {} + + //Constructors + inline multialloc_iterator& operator++() + { increment(); return *this; } + + inline multialloc_iterator operator++(int) + { + multialloc_iterator result (*this); + increment(); + return result; + } + + inline friend bool operator== (const multialloc_iterator& i, const multialloc_iterator& i2) + { return i.equal(i2); } + + inline friend bool operator!= (const multialloc_iterator& i, const multialloc_iterator& i2) + { return !(i == i2); } + + inline friend typename Iterator::difference_type operator- (const multialloc_iterator& i, const multialloc_iterator& i2) + { return i2.distance_to(i); } + + //Arithmetic + inline multialloc_iterator& operator+=(typename Iterator::difference_type off) + { this->advance(off); return *this; } + + inline multialloc_iterator operator+(typename Iterator::difference_type off) const + { + multialloc_iterator other(*this); + other.advance(off); + return other; + } + + inline friend multialloc_iterator operator+(typename Iterator::difference_type off, const multialloc_iterator& right) + { return right + off; } + + inline multialloc_iterator& operator-=(typename Iterator::difference_type off) + { this->advance(-off); return *this; } + + inline multialloc_iterator operator-(typename Iterator::difference_type off) const + { return *this + (-off); } + + inline T& operator*() const + { return *this->operator->(); } + + inline T* operator->() const + { return static_cast<T*>(static_cast<void*>(boost::movelib::iterator_to_raw_pointer(m_it))); } + + inline Iterator & base() + { return m_it; } + + inline const Iterator & base() const + { return m_it; } + + private: + Iterator m_it; + + inline void increment() + { ++m_it; } + + inline void decrement() + { --m_it; } + + inline bool equal(const multialloc_iterator &other) const + { return m_it == other.m_it; } + + inline bool less(const multialloc_iterator &other) const + { return other.m_it < m_it; } + + inline void advance(typename Iterator::difference_type n) + { boost::container::iterator_advance(m_it, n); } + + inline typename Iterator::difference_type distance_to(const multialloc_iterator &other)const + { return boost::container::iterator_distance(other.m_it, m_it); } }; + template<class MultiallocationChain, class T> class transform_multiallocation_chain : public MultiallocationChain @@ -217,9 +304,8 @@ class transform_multiallocation_chain { return pointer_traits::static_cast_from(p); } public: - typedef transform_iterator - < typename MultiallocationChain::iterator - , dtl::cast_functor <T> > iterator; + typedef multialloc_iterator + <typename MultiallocationChain::iterator, T> iterator; typedef typename MultiallocationChain::size_type size_type; typedef boost::intrusive::twin<pointer> pointer_pair; diff --git a/contrib/restricted/boost/container/include/boost/container/detail/node_alloc_holder.hpp b/contrib/restricted/boost/container/include/boost/container/detail/node_alloc_holder.hpp index 1ebf21ad84..32023e396a 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/node_alloc_holder.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/node_alloc_holder.hpp @@ -31,12 +31,14 @@ #include <boost/container/detail/construct_in_place.hpp> #include <boost/container/detail/destroyers.hpp> #include <boost/move/detail/iterator_to_raw_pointer.hpp> +#include <boost/move/detail/launder.hpp> #include <boost/container/detail/mpl.hpp> #include <boost/container/detail/placement_new.hpp> #include <boost/move/detail/to_raw_pointer.hpp> #include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/version_type.hpp> #include <boost/container/detail/is_pair.hpp> +#include <boost/container/detail/pair.hpp> // intrusive #include <boost/intrusive/detail/mpl.hpp> #include <boost/intrusive/options.hpp> @@ -119,16 +121,16 @@ struct base_node } inline T &get_data() - { return *move_detail::force_ptr<T*>(this->m_storage.data); } + { return *move_detail::force_ptr<T*>(&this->m_storage); } inline const T &get_data() const - { return *move_detail::force_ptr<const T*>(this->m_storage.data); } + { return *move_detail::launder_cast<const T*>(&this->m_storage); } inline internal_type &get_real_data() - { return *move_detail::force_ptr<internal_type*>(this->m_storage.data); } + { return *move_detail::launder_cast<internal_type*>(&this->m_storage); } inline const internal_type &get_real_data() const - { return *move_detail::force_ptr<const internal_type*>(this->m_storage.data); } + { return *move_detail::launder_cast<const internal_type*>(&this->m_storage); } #if defined(BOOST_CONTAINER_DISABLE_ALIASING_WARNING) #pragma GCC diagnostic pop @@ -534,6 +536,19 @@ struct node_alloc_holder return this->icont().erase_and_dispose(k, chain_holder.get_chain_builder()); } + template<class Key, class KeyCompare> + inline size_type erase_key(const Key& k, KeyCompare cmp, version_1) + { + return this->icont().erase_and_dispose(k, cmp, Destroyer(this->node_alloc())); + } + + template<class Key, class KeyCompare> + inline size_type erase_key(const Key& k, KeyCompare cmp, version_2) + { + allocator_multialloc_chain_node_deallocator<NodeAlloc> chain_holder(this->node_alloc()); + return this->icont().erase_and_dispose(k, cmp, chain_holder.get_chain_builder()); + } + protected: struct cloner { diff --git a/contrib/restricted/boost/container/include/boost/container/detail/pair.hpp b/contrib/restricted/boost/container/include/boost/container/detail/pair.hpp index 58e560817a..0e84ffbf44 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/pair.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/pair.hpp @@ -29,7 +29,7 @@ #include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/mpl.hpp> #include <boost/container/detail/std_fwd.hpp> -#include <boost/container/detail/is_pair.hpp> +#include <boost/container/detail/is_pair.hpp> //Forward declares boost::tuples::tuple #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) # include <boost/container/detail/variadic_templates_tools.hpp> #endif @@ -46,7 +46,7 @@ namespace pair_impl { template <class TupleClass> struct is_boost_tuple { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template < @@ -56,7 +56,7 @@ template < class T9> struct is_boost_tuple< boost::tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> > { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template<class Tuple> @@ -67,13 +67,13 @@ struct disable_if_boost_tuple template<class T> struct is_tuple_null { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template<> struct is_tuple_null<boost::tuples::null_type> { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; } //namespace detail { @@ -482,7 +482,7 @@ inline void swap(pair<T1, T2>& x, pair<T1, T2>& y) template<class T1, class T2> struct has_move_emulation_enabled< ::boost::container::dtl::pair<T1, T2> > { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; #endif @@ -497,7 +497,7 @@ struct is_class_or_union< ::boost::container::dtl::pair<T1, T2> > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template <class T1, class T2> @@ -505,7 +505,7 @@ struct is_class_or_union< std::pair<T1, T2> > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template<class T> @@ -516,7 +516,7 @@ struct is_union< ::boost::container::dtl::pair<T1, T2> > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template <class T1, class T2> @@ -524,7 +524,7 @@ struct is_union< std::pair<T1, T2> > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template<class T> @@ -535,7 +535,7 @@ struct is_class< ::boost::container::dtl::pair<T1, T2> > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; template <class T1, class T2> @@ -543,7 +543,7 @@ struct is_class< std::pair<T1, T2> > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { - static const bool value = true; + BOOST_STATIC_CONSTEXPR bool value = true; }; @@ -555,7 +555,7 @@ template<class A, class B> struct is_trivially_copy_assignable <boost::container::dtl::pair<A,B> > { - static const bool value = false ; + BOOST_STATIC_CONSTEXPR bool value = false ; }; template<class T> @@ -565,7 +565,7 @@ template<class A, class B> struct is_trivially_move_assignable <boost::container::dtl::pair<A,B> > { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template<class T> @@ -574,7 +574,7 @@ struct is_trivially_copy_assignable; template<class A, class B> struct is_trivially_copy_constructible<boost::container::dtl::pair<A,B> > { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template<class T> @@ -583,7 +583,7 @@ struct is_trivially_move_assignable; template<class A, class B> struct is_trivially_move_constructible<boost::container::dtl::pair<A,B> > { - static const bool value = false; + BOOST_STATIC_CONSTEXPR bool value = false; }; template<class T> @@ -592,7 +592,7 @@ struct is_trivially_destructible; template<class A, class B> struct is_trivially_destructible<boost::container::dtl::pair<A,B> > { - static const bool value = boost::move_detail::is_trivially_destructible<A>::value && + BOOST_STATIC_CONSTEXPR bool value = boost::move_detail::is_trivially_destructible<A>::value && boost::move_detail::is_trivially_destructible<B>::value ; }; diff --git a/contrib/restricted/boost/container/include/boost/container/detail/pool_resource.hpp b/contrib/restricted/boost/container/include/boost/container/detail/pool_resource.hpp index 87eecacce1..a98dc70b63 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/pool_resource.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/pool_resource.hpp @@ -31,11 +31,11 @@ namespace pmr { class pool_data_t; -static const std::size_t pool_options_minimum_max_blocks_per_chunk = 1u; -static const std::size_t pool_options_default_max_blocks_per_chunk = 32u; -static const std::size_t pool_options_minimum_largest_required_pool_block = +BOOST_CONTAINER_CONSTANT_VAR std::size_t pool_options_minimum_max_blocks_per_chunk = 1u; +BOOST_CONTAINER_CONSTANT_VAR std::size_t pool_options_default_max_blocks_per_chunk = 32u; +BOOST_CONTAINER_CONSTANT_VAR std::size_t pool_options_minimum_largest_required_pool_block = memory_resource::max_align > 2*sizeof(void*) ? memory_resource::max_align : 2*sizeof(void*); -static const std::size_t pool_options_default_largest_required_pool_block = +BOOST_CONTAINER_CONSTANT_VAR std::size_t pool_options_default_largest_required_pool_block = pool_options_minimum_largest_required_pool_block > 4096u ? pool_options_minimum_largest_required_pool_block : 4096u; diff --git a/contrib/restricted/boost/container/include/boost/container/detail/transform_iterator.hpp b/contrib/restricted/boost/container/include/boost/container/detail/transform_iterator.hpp deleted file mode 100644 index 35b64b85fe..0000000000 --- a/contrib/restricted/boost/container/include/boost/container/detail/transform_iterator.hpp +++ /dev/null @@ -1,180 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005-2013. -// (C) Copyright Gennaro Prota 2003 - 2004. -// -// 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) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP -#define BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> -#include <boost/container/detail/type_traits.hpp> -#include <boost/container/detail/iterator.hpp> - -namespace boost { -namespace container { - -template <class PseudoReference> -struct operator_arrow_proxy -{ - inline operator_arrow_proxy(const PseudoReference &px) - : m_value(px) - {} - - typedef PseudoReference element_type; - - inline PseudoReference* operator->() const { return &m_value; } - - mutable PseudoReference m_value; -}; - -template <class T> -struct operator_arrow_proxy<T&> -{ - inline operator_arrow_proxy(T &px) - : m_value(px) - {} - - typedef T element_type; - - inline T* operator->() const { return const_cast<T*>(&m_value); } - - T &m_value; -}; - -template <class Iterator, class UnaryFunction> -class transform_iterator - : public UnaryFunction - , public boost::container::iterator - < typename Iterator::iterator_category - , typename dtl::remove_reference<typename UnaryFunction::result_type>::type - , typename Iterator::difference_type - , operator_arrow_proxy<typename UnaryFunction::result_type> - , typename UnaryFunction::result_type> -{ - public: - inline explicit transform_iterator(const Iterator &it, const UnaryFunction &f = UnaryFunction()) - : UnaryFunction(f), m_it(it) - {} - - inline explicit transform_iterator() - : UnaryFunction(), m_it() - {} - - //Constructors - inline transform_iterator& operator++() - { increment(); return *this; } - - inline transform_iterator operator++(int) - { - transform_iterator result (*this); - increment(); - return result; - } - - inline friend bool operator== (const transform_iterator& i, const transform_iterator& i2) - { return i.equal(i2); } - - inline friend bool operator!= (const transform_iterator& i, const transform_iterator& i2) - { return !(i == i2); } - -/* - friend bool operator> (const transform_iterator& i, const transform_iterator& i2) - { return i2 < i; } - - friend bool operator<= (const transform_iterator& i, const transform_iterator& i2) - { return !(i > i2); } - - friend bool operator>= (const transform_iterator& i, const transform_iterator& i2) - { return !(i < i2); } -*/ - inline friend typename Iterator::difference_type operator- (const transform_iterator& i, const transform_iterator& i2) - { return i2.distance_to(i); } - - //Arithmetic - inline transform_iterator& operator+=(typename Iterator::difference_type off) - { this->advance(off); return *this; } - - inline transform_iterator operator+(typename Iterator::difference_type off) const - { - transform_iterator other(*this); - other.advance(off); - return other; - } - - inline friend transform_iterator operator+(typename Iterator::difference_type off, const transform_iterator& right) - { return right + off; } - - inline transform_iterator& operator-=(typename Iterator::difference_type off) - { this->advance(-off); return *this; } - - inline transform_iterator operator-(typename Iterator::difference_type off) const - { return *this + (-off); } - - inline typename UnaryFunction::result_type operator*() const - { return dereference(); } - - inline operator_arrow_proxy<typename UnaryFunction::result_type> - operator->() const - { return operator_arrow_proxy<typename UnaryFunction::result_type>(dereference()); } - - inline Iterator & base() - { return m_it; } - - inline const Iterator & base() const - { return m_it; } - - private: - Iterator m_it; - - inline void increment() - { ++m_it; } - - inline void decrement() - { --m_it; } - - inline bool equal(const transform_iterator &other) const - { return m_it == other.m_it; } - - inline bool less(const transform_iterator &other) const - { return other.m_it < m_it; } - - inline typename UnaryFunction::result_type dereference() const - { return UnaryFunction::operator()(*m_it); } - - inline void advance(typename Iterator::difference_type n) - { boost::container::iterator_advance(m_it, n); } - - inline typename Iterator::difference_type distance_to(const transform_iterator &other)const - { return boost::container::iterator_distance(other.m_it, m_it); } -}; - -template <class Iterator, class UnaryFunc> -inline transform_iterator<Iterator, UnaryFunc> -make_transform_iterator(Iterator it, UnaryFunc fun) -{ - return transform_iterator<Iterator, UnaryFunc>(it, fun); -} - -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //#ifndef BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP diff --git a/contrib/restricted/boost/container/include/boost/container/detail/tree.hpp b/contrib/restricted/boost/container/include/boost/container/detail/tree.hpp index f4a27b200e..1a3aa421a6 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/tree.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/tree.hpp @@ -52,7 +52,6 @@ #include <boost/move/detail/fwd_macros.hpp> #endif #include <boost/move/detail/move_helpers.hpp> -#include <boost/move/detail/force_ptr.hpp> @@ -252,13 +251,13 @@ struct intrusive_tree_type //Trait to detect manually rebalanceable tree types template<boost::container::tree_type_enum tree_type_value> struct is_manually_balanceable -{ static const bool value = true; }; +{ BOOST_STATIC_CONSTEXPR bool value = true; }; template<> struct is_manually_balanceable<red_black_tree> -{ static const bool value = false; }; +{ BOOST_STATIC_CONSTEXPR bool value = false; }; template<> struct is_manually_balanceable<avl_tree> -{ static const bool value = false; }; +{ BOOST_STATIC_CONSTEXPR bool value = false; }; //Proxy traits to implement different operations depending on the //is_manually_balanceable<>::value @@ -689,40 +688,13 @@ class tree boost::container::dtl::is_nothrow_move_assignable<Compare>::value) { if (BOOST_LIKELY(this != &x)) { - NodeAlloc &this_alloc = this->node_alloc(); - NodeAlloc &x_alloc = x.node_alloc(); - const bool propagate_alloc = allocator_traits<NodeAlloc>:: - propagate_on_container_move_assignment::value; - const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal; - //Resources can be transferred if both allocators are - //going to be equal after this function (either propagated or already equal) - if(propagate_alloc || allocators_equal){ - //Destroy - this->clear(); - //Move allocator if needed - this->AllocHolder::move_assign_alloc(x); - //Obtain resources - this->icont() = boost::move(x.icont()); - } - //Else do a one by one move - else{ - //Transfer all the nodes to a temporary tree - //If anything goes wrong, all the nodes will be destroyed - //automatically - Icont other_tree(::boost::move(this->icont())); - - //Now recreate the source tree reusing nodes stored by other_tree - this->icont().clone_from - (::boost::move(x.icont()) - , RecyclingCloner<AllocHolder, true>(*this, other_tree) - , Destroyer(this->node_alloc())); - - //If there are remaining nodes, destroy them - NodePtr p; - while((p = other_tree.unlink_leftmost_without_rebalance())){ - AllocHolder::destroy_node(p); - } - } + //We know resources can be transferred at comiple time if both allocators are + //always equal or the allocator is going to be propagated + const bool can_steal_resources_alloc + = allocator_traits_type::propagate_on_container_move_assignment::value + || allocator_traits_type::is_always_equal::value; + dtl::bool_<can_steal_resources_alloc> flag; + this->priv_move_assign(boost::move(x), flag); } return *this; } @@ -896,6 +868,42 @@ class tree private: + void priv_move_assign(BOOST_RV_REF(tree) x, dtl::bool_<true> /*steal_resources*/) + { + //Destroy objects but retain memory in case x reuses it in the future + this->clear(); + //Move allocator if needed + this->AllocHolder::move_assign_alloc(x); + //Obtain resources + this->icont() = boost::move(x.icont()); + } + + void priv_move_assign(BOOST_RV_REF(tree) x, dtl::bool_<false> /*steal_resources*/) + { + //We can't guarantee a compile-time equal allocator or propagation so fallback to runtime + //Resources can be transferred if both allocators are equal + if (this->node_alloc() == x.node_alloc()) { + this->priv_move_assign(boost::move(x), dtl::true_()); + } + else { + //Transfer all the nodes to a temporary tree + //If anything goes wrong, all the nodes will be destroyed + //automatically + Icont other_tree(::boost::move(this->icont())); + + //Now recreate the source tree reusing nodes stored by other_tree + this->icont().clone_from + (::boost::move(x.icont()) + , RecyclingCloner<AllocHolder, true>(*this, other_tree) + , Destroyer(this->node_alloc())); + + //If there are remaining nodes, destroy them + NodePtr p; + while ((p = other_tree.unlink_leftmost_without_rebalance())) { + AllocHolder::destroy_node(p); + } + } + } template<class KeyConvertible, class M> iiterator priv_insert_or_assign_commit @@ -1134,6 +1142,31 @@ class tree return ret; } + template <class K> + inline typename dtl::enable_if_c< + dtl::is_transparent<key_compare>::value && //transparent + !dtl::is_convertible<K, iterator>::value && //not convertible to iterator + !dtl::is_convertible<K, const_iterator>::value //not convertible to const_iterator + , size_type>::type + erase(const K& k) + { return AllocHolder::erase_key(k, KeyNodeCompare(key_comp()), alloc_version()); } + + template <class K> + inline typename dtl::enable_if_c< + dtl::is_transparent<key_compare>::value && //transparent + !dtl::is_convertible<K, iterator>::value && //not convertible to iterator + !dtl::is_convertible<K, const_iterator>::value //not convertible to const_iterator + , size_type>::type + erase_unique(const K& k) + { + iterator i = this->find(k); + size_type ret = static_cast<size_type>(i != this->end()); + + if (ret) + this->erase(i); + return ret; + } + iterator erase(const_iterator first, const_iterator last) { BOOST_ASSERT(first == last || (first != this->cend() && (priv_is_linked)(first))); @@ -1232,13 +1265,13 @@ class tree BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent<key_compare, K, iterator>::type find(const K& k) - { return iterator(this->icont().find(k, KeyNodeCompare())); } + { return iterator(this->icont().find(k, KeyNodeCompare(key_comp()))); } template <class K> BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent<key_compare, K, const_iterator>::type find(const K& k) const - { return const_iterator(this->non_const_icont().find(k, KeyNodeCompare())); } + { return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(key_comp()))); } BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline size_type count(const key_type& k) const @@ -1248,7 +1281,7 @@ class tree BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent<key_compare, K, size_type>::type count(const K& k) const - { return size_type(this->icont().count(k, KeyNodeCompare())); } + { return size_type(this->icont().count(k, KeyNodeCompare(key_comp()))); } BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline bool contains(const key_type& x) const @@ -1272,13 +1305,13 @@ class tree BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent<key_compare, K, iterator>::type lower_bound(const K& k) - { return iterator(this->icont().lower_bound(k, KeyNodeCompare())); } + { return iterator(this->icont().lower_bound(k, KeyNodeCompare(key_comp()))); } template <class K> BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent<key_compare, K, const_iterator>::type lower_bound(const K& k) const - { return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare())); } + { return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(key_comp()))); } BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline iterator upper_bound(const key_type& k) @@ -1292,13 +1325,13 @@ class tree BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent<key_compare, K, iterator>::type upper_bound(const K& k) - { return iterator(this->icont().upper_bound(k, KeyNodeCompare())); } + { return iterator(this->icont().upper_bound(k, KeyNodeCompare(key_comp()))); } template <class K> BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline typename dtl::enable_if_transparent<key_compare, K, const_iterator>::type upper_bound(const K& k) const - { return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare())); } + { return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(key_comp()))); } BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline std::pair<iterator,iterator> equal_range(const key_type& k) @@ -1322,7 +1355,7 @@ class tree equal_range(const K& k) { std::pair<iiterator, iiterator> ret = - this->icont().equal_range(k, KeyNodeCompare()); + this->icont().equal_range(k, KeyNodeCompare(key_comp())); return std::pair<iterator,iterator>(iterator(ret.first), iterator(ret.second)); } @@ -1332,7 +1365,7 @@ class tree equal_range(const K& k) const { std::pair<iiterator, iiterator> ret = - this->non_const_icont().equal_range(k, KeyNodeCompare()); + this->non_const_icont().equal_range(k, KeyNodeCompare(key_comp())); return std::pair<const_iterator,const_iterator> (const_iterator(ret.first), const_iterator(ret.second)); } @@ -1360,7 +1393,7 @@ class tree lower_bound_range(const K& k) { std::pair<iiterator, iiterator> ret = - this->icont().lower_bound_range(k, KeyNodeCompare()); + this->icont().lower_bound_range(k, KeyNodeCompare(key_comp())); return std::pair<iterator,iterator>(iterator(ret.first), iterator(ret.second)); } @@ -1370,7 +1403,7 @@ class tree lower_bound_range(const K& k) const { std::pair<iiterator, iiterator> ret = - this->non_const_icont().lower_bound_range(k, KeyNodeCompare()); + this->non_const_icont().lower_bound_range(k, KeyNodeCompare(key_comp())); return std::pair<const_iterator,const_iterator> (const_iterator(ret.first), const_iterator(ret.second)); } @@ -1425,9 +1458,10 @@ struct has_trivial_destructor_after_move { typedef typename ::boost::container::dtl::tree<T, KeyOfValue, Compare, Allocator, Options>::allocator_type allocator_type; typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<allocator_type>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value && - ::boost::has_trivial_destructor_after_move<Compare>::value; + BOOST_STATIC_CONSTEXPR bool value = + ::boost::has_trivial_destructor_after_move<allocator_type>::value && + ::boost::has_trivial_destructor_after_move<pointer>::value && + ::boost::has_trivial_destructor_after_move<Compare>::value; }; } //namespace boost { diff --git a/contrib/restricted/boost/container/include/boost/container/detail/version_type.hpp b/contrib/restricted/boost/container/include/boost/container/detail/version_type.hpp index 389606a567..e02244ac84 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/version_type.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/version_type.hpp @@ -57,20 +57,20 @@ struct has_version template <class U> static two test(...); template <class U> static char test(const typename U::version*); public: - static const bool value = sizeof(test<T>(0)) == 1; + BOOST_STATIC_CONSTEXPR bool value = sizeof(test<T>(0)) == 1; void dummy(){} }; template <class T, bool = has_version<T>::value> struct version { - static const unsigned value = 1; + BOOST_STATIC_CONSTEXPR unsigned value = 1; }; template <class T> struct version<T, true> { - static const unsigned value = extract_version<T>::type::value; + BOOST_STATIC_CONSTEXPR unsigned value = extract_version<T>::type::value; }; } //namespace impl @@ -83,7 +83,7 @@ struct version template<class T, unsigned N> struct is_version { - static const bool value = + BOOST_STATIC_CONSTEXPR bool value = is_same< typename version<T>::type, integral_constant<unsigned, N> >::value; }; diff --git a/contrib/restricted/boost/container/include/boost/container/detail/workaround.hpp b/contrib/restricted/boost/container/include/boost/container/detail/workaround.hpp index 23342bb0d1..055cf24d3a 100644 --- a/contrib/restricted/boost/container/include/boost/container/detail/workaround.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/workaround.hpp @@ -230,4 +230,16 @@ namespace boost { # define BOOST_CONTAINER_STATIC_ASSERT_MSG( B, Msg ) BOOST_CONTAINER_STATIC_ASSERT( B ) #endif +#if !defined(BOOST_NO_CXX17_INLINE_VARIABLES) +# define BOOST_CONTAINER_CONSTANT_VAR BOOST_INLINE_CONSTEXPR +#else +# define BOOST_CONTAINER_CONSTANT_VAR static BOOST_CONSTEXPR_OR_CONST +#endif + +#if defined(__GNUC__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600) +#define BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED +#elif defined(__clang__) +#define BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED +#endif + #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP diff --git a/contrib/restricted/boost/container/include/boost/container/new_allocator.hpp b/contrib/restricted/boost/container/include/boost/container/new_allocator.hpp index b01b9ba8f2..1dadb2b7ae 100644 --- a/contrib/restricted/boost/container/include/boost/container/new_allocator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/new_allocator.hpp @@ -33,7 +33,7 @@ namespace container { template<bool Value> struct new_allocator_bool -{ static const bool value = Value; }; +{ BOOST_STATIC_CONSTEXPR bool value = Value; }; template<class T> class new_allocator; diff --git a/contrib/restricted/boost/container/include/boost/container/node_handle.hpp b/contrib/restricted/boost/container/include/boost/container/node_handle.hpp index 41bea974c3..5179022d8e 100644 --- a/contrib/restricted/boost/container/include/boost/container/node_handle.hpp +++ b/contrib/restricted/boost/container/include/boost/container/node_handle.hpp @@ -23,6 +23,7 @@ #include <boost/container/detail/workaround.hpp> #include <boost/container/detail/placement_new.hpp> #include <boost/move/detail/to_raw_pointer.hpp> +#include <boost/move/detail/launder.hpp> #include <boost/container/allocator_traits.hpp> #include <boost/container/detail/mpl.hpp> @@ -146,7 +147,7 @@ class node_handle } void destroy_alloc() BOOST_NOEXCEPT - { static_cast<nallocator_type*>((void*)m_nalloc_storage.data)->~nallocator_type(); } + { move_detail::launder_cast<nallocator_type*>(&m_nalloc_storage)->~nallocator_type(); } node_pointer &get_node_pointer() BOOST_NOEXCEPT { return m_ptr; } @@ -231,7 +232,7 @@ class node_handle if(was_nh_non_null){ if(was_this_non_null){ this->destroy_deallocate_node(); - if(nator_traits::propagate_on_container_move_assignment::value){ + BOOST_IF_CONSTEXPR(nator_traits::propagate_on_container_move_assignment::value){ this->node_alloc() = ::boost::move(nh.node_alloc()); } } @@ -335,7 +336,7 @@ class node_handle if(was_nh_non_null){ if(was_this_non_null){ - if(nator_traits::propagate_on_container_swap::value){ + BOOST_IF_CONSTEXPR(nator_traits::propagate_on_container_swap::value){ ::boost::adl_move_swap(this->node_alloc(), nh.node_alloc()); } } @@ -381,7 +382,7 @@ class node_handle nallocator_type &node_alloc() BOOST_NOEXCEPT { BOOST_ASSERT(!empty()); - return *static_cast<nallocator_type*>((void*)m_nalloc_storage.data); + return *move_detail::launder_cast<nallocator_type*>(&m_nalloc_storage); } @@ -391,7 +392,7 @@ class node_handle const nallocator_type &node_alloc() const BOOST_NOEXCEPT { BOOST_ASSERT(!empty()); - return *static_cast<const nallocator_type*>((const void*)m_nalloc_storage.data); + return *move_detail::launder_cast<const nallocator_type*>(&m_nalloc_storage); } //! <b>Effects</b>: x.swap(y). diff --git a/contrib/restricted/boost/container/include/boost/container/options.hpp b/contrib/restricted/boost/container/include/boost/container/options.hpp index 48edd38197..dad41b7aef 100644 --- a/contrib/restricted/boost/container/include/boost/container/options.hpp +++ b/contrib/restricted/boost/container/include/boost/container/options.hpp @@ -52,8 +52,8 @@ enum tree_type_enum template<tree_type_enum TreeType, bool OptimizeSize> struct tree_opt { - static const boost::container::tree_type_enum tree_type = TreeType; - static const bool optimize_size = OptimizeSize; + BOOST_STATIC_CONSTEXPR boost::container::tree_type_enum tree_type = TreeType; + BOOST_STATIC_CONSTEXPR bool optimize_size = OptimizeSize; }; typedef tree_opt<red_black_tree, true> tree_assoc_defaults; @@ -116,10 +116,10 @@ using tree_assoc_options_t = typename boost::container::tree_assoc_options<Optio template<bool StoreHash, bool CacheBegin, bool LinearBuckets, bool FastmodBuckets> struct hash_opt { - static const bool store_hash = StoreHash; - static const bool cache_begin = CacheBegin; - static const bool linear_buckets = LinearBuckets; - static const bool fastmod_buckets = FastmodBuckets; + BOOST_STATIC_CONSTEXPR bool store_hash = StoreHash; + BOOST_STATIC_CONSTEXPR bool cache_begin = CacheBegin; + BOOST_STATIC_CONSTEXPR bool linear_buckets = LinearBuckets; + BOOST_STATIC_CONSTEXPR bool fastmod_buckets = FastmodBuckets; }; typedef hash_opt<false, false, false, false> hash_assoc_defaults; @@ -203,13 +203,13 @@ struct default_if_void<void, Default> template<std::size_t N, std::size_t DefaultN> struct default_if_zero { - static const std::size_t value = N; + BOOST_STATIC_CONSTEXPR std::size_t value = N; }; template<std::size_t DefaultN> struct default_if_zero<0u, DefaultN> { - static const std::size_t value = DefaultN; + BOOST_STATIC_CONSTEXPR std::size_t value = DefaultN; }; @@ -364,7 +364,7 @@ template<class GrowthType, std::size_t InplaceAlignment> struct small_vector_opt { typedef GrowthType growth_factor_type; - static const std::size_t inplace_alignment = InplaceAlignment; + BOOST_STATIC_CONSTEXPR std::size_t inplace_alignment = InplaceAlignment; }; typedef small_vector_opt<void, 0u> small_vector_null_opt; @@ -430,8 +430,8 @@ BOOST_INTRUSIVE_OPTION_CONSTANT(throw_on_overflow, bool, ThrowOnOverflow, throw_ template<bool ThrowOnOverflow, std::size_t InplaceAlignment> struct static_vector_opt { - static const bool throw_on_overflow = ThrowOnOverflow; - static const std::size_t inplace_alignment = InplaceAlignment; + BOOST_STATIC_CONSTEXPR bool throw_on_overflow = ThrowOnOverflow; + BOOST_STATIC_CONSTEXPR std::size_t inplace_alignment = InplaceAlignment; }; typedef static_vector_opt<true, 0u> static_vector_null_opt; @@ -515,7 +515,7 @@ template<class GrowthType, class StoredSizeType, std::size_t FreeFraction> struct devector_opt : vector_opt<GrowthType, StoredSizeType> { - static const std::size_t free_fraction = FreeFraction; + BOOST_STATIC_CONSTEXPR std::size_t free_fraction = FreeFraction; }; typedef devector_opt<void, void, 0u> devector_null_opt; @@ -606,8 +606,8 @@ using devector_options_t = typename boost::container::devector_options<Options.. template<std::size_t BlockBytes, std::size_t BlockSize> struct deque_opt { - static const std::size_t block_bytes = BlockBytes; - static const std::size_t block_size = BlockSize; + BOOST_STATIC_CONSTEXPR std::size_t block_bytes = BlockBytes; + BOOST_STATIC_CONSTEXPR std::size_t block_size = BlockSize; BOOST_CONTAINER_STATIC_ASSERT_MSG(!(block_bytes && block_size), "block_bytes and block_size can't be specified at the same time"); }; @@ -617,7 +617,7 @@ typedef deque_opt<0u, 0u> deque_null_opt; //! Helper metafunction to combine options into a single type to be used //! by \c boost::container::deque. -//! Supported options are: \c boost::container::block_bytes +//! Supported options are: \c boost::container::block_bytes and \c boost::container::block_size #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES) template<class ...Options> #else diff --git a/contrib/restricted/boost/container/include/boost/container/pmr/memory_resource.hpp b/contrib/restricted/boost/container/include/boost/container/pmr/memory_resource.hpp index 4187f05f3c..b54e75f2d6 100644 --- a/contrib/restricted/boost/container/include/boost/container/pmr/memory_resource.hpp +++ b/contrib/restricted/boost/container/include/boost/container/pmr/memory_resource.hpp @@ -32,7 +32,7 @@ class memory_resource { public: // For exposition only - static BOOST_CONSTEXPR_OR_CONST std::size_t max_align = + BOOST_STATIC_CONSTEXPR std::size_t max_align = boost::move_detail::alignment_of<boost::move_detail::max_align_t>::value; //! <b>Effects</b>: Destroys diff --git a/contrib/restricted/boost/container/include/boost/container/pmr/monotonic_buffer_resource.hpp b/contrib/restricted/boost/container/include/boost/container/pmr/monotonic_buffer_resource.hpp index 6799f4f278..a52bbf8883 100644 --- a/contrib/restricted/boost/container/include/boost/container/pmr/monotonic_buffer_resource.hpp +++ b/contrib/restricted/boost/container/include/boost/container/pmr/monotonic_buffer_resource.hpp @@ -70,7 +70,7 @@ class BOOST_CONTAINER_DECL monotonic_buffer_resource //! to the upstream allocator //! //! <b>Note</b>: Non-standard extension. - static const std::size_t initial_next_buffer_size = 32u*sizeof(void*); + BOOST_STATIC_CONSTEXPR std::size_t initial_next_buffer_size = 32u*sizeof(void*); //! <b>Requires</b>: `upstream` shall be the address of a valid memory resource or `nullptr` //! diff --git a/contrib/restricted/boost/container/include/boost/container/scoped_allocator.hpp b/contrib/restricted/boost/container/include/boost/container/scoped_allocator.hpp index a979ad658a..90e340622d 100644 --- a/contrib/restricted/boost/container/include/boost/container/scoped_allocator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/scoped_allocator.hpp @@ -56,7 +56,7 @@ struct is_scoped_allocator_imp template <typename T> static int test(...); - static const bool value = (sizeof(yes_type) == sizeof(test<Allocator>(0))); + BOOST_STATIC_CONSTEXPR bool value = (sizeof(yes_type) == sizeof(test<Allocator>(0))); }; template<class MaybeScopedAlloc, bool = is_scoped_allocator_imp<MaybeScopedAlloc>::value > diff --git a/contrib/restricted/boost/container/include/boost/container/set.hpp b/contrib/restricted/boost/container/include/boost/container/set.hpp index 1aef8ff002..e71a1ece31 100644 --- a/contrib/restricted/boost/container/include/boost/container/set.hpp +++ b/contrib/restricted/boost/container/include/boost/container/set.hpp @@ -1026,7 +1026,7 @@ template <class Key, class Compare, class Allocator, class Options> struct has_trivial_destructor_after_move<boost::container::set<Key, Compare, Allocator, Options> > { typedef ::boost::container::dtl::tree<Key, void, Compare, Allocator, Options> tree; - static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value; + BOOST_STATIC_CONSTEXPR bool value = ::boost::has_trivial_destructor_after_move<tree>::value; }; namespace container { @@ -1681,7 +1681,7 @@ template <class Key, class Compare, class Allocator, class Options> struct has_trivial_destructor_after_move<boost::container::multiset<Key, Compare, Allocator, Options> > { typedef ::boost::container::dtl::tree<Key, void, Compare, Allocator, Options> tree; - static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value; + BOOST_STATIC_CONSTEXPR bool value = ::boost::has_trivial_destructor_after_move<tree>::value; }; namespace container { diff --git a/contrib/restricted/boost/container/include/boost/container/small_vector.hpp b/contrib/restricted/boost/container/include/boost/container/small_vector.hpp index 28adc46b88..5882326f2c 100644 --- a/contrib/restricted/boost/container/include/boost/container/small_vector.hpp +++ b/contrib/restricted/boost/container/include/boost/container/small_vector.hpp @@ -39,7 +39,6 @@ #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include <boost/move/detail/fwd_macros.hpp> #endif -#include <boost/move/detail/force_ptr.hpp> //std #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -284,7 +283,7 @@ class small_vector_allocator { return !(l == r); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: + public: typedef small_vector_base<value_type, allocator_type, Options> derived_type; typedef typename dtl::vector_for_small_vector @@ -305,13 +304,13 @@ struct small_vector_storage typedef typename dtl::aligned_storage <sizeof(T)*N, Alignment>::type storage_type; storage_type m_storage; - static const std::size_t sms_size = sizeof(storage_type)/sizeof(T); + BOOST_STATIC_CONSTEXPR std::size_t sms_size = sizeof(storage_type)/sizeof(T); }; template<class T, std::size_t Alignment> struct small_vector_storage<T, 0u, Alignment> { - static const std::size_t sms_size = 0u; + BOOST_STATIC_CONSTEXPR std::size_t sms_size = 0u; }; //! This class consists of common code from all small_vector<T, N> types that don't depend on the @@ -347,9 +346,10 @@ class small_vector_base public: //Make it public as it will be inherited by small_vector and container //must have this public member - typedef typename real_allocator<T, SecAlloc>::type allocator_type; - typedef typename allocator_traits<allocator_type>:: - template portable_rebind_alloc<void>::type void_allocator_t; + typedef typename real_allocator<T, SecAlloc>::type underlying_allocator_t; + typedef typename allocator_traits<underlying_allocator_t>:: + template portable_rebind_alloc<void>::type void_underlying_allocator_t; + typedef small_vector_allocator<T, void_underlying_allocator_t, Options>allocator_type; typedef typename dtl::get_small_vector_opt<Options>::type options_t; typedef typename dtl::vector_for_small_vector <T, SecAlloc, Options>::type base_type; @@ -357,12 +357,13 @@ class small_vector_base typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; typedef typename allocator_traits<allocator_type>::void_pointer void_pointer; typedef typename allocator_traits<allocator_type>::const_void_pointer const_void_pointer; - typedef small_vector_allocator<T, void_allocator_t, Options> small_allocator_type; + typedef typename base_type::size_type size_type; + private: BOOST_COPYABLE_AND_MOVABLE(small_vector_base) - friend class small_vector_allocator<T, void_allocator_t, Options>; + friend class small_vector_allocator<T, void_underlying_allocator_t, Options>; inline const_pointer internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW @@ -378,18 +379,26 @@ class small_vector_base public: + BOOST_CONTAINER_ATTRIBUTE_NODISCARD bool is_small() const + { return this->internal_storage() == this->data(); } + protected: - inline explicit small_vector_base(initial_capacity_t, std::size_t initial_capacity) + inline explicit small_vector_base(initial_capacity_t, size_type initial_capacity) : base_type(initial_capacity_t(), this->internal_storage(), initial_capacity) {} template<class AllocFwd> - inline explicit small_vector_base(initial_capacity_t, std::size_t capacity, BOOST_FWD_REF(AllocFwd) a) + inline explicit small_vector_base(initial_capacity_t, size_type capacity, BOOST_FWD_REF(AllocFwd) a) : base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward<AllocFwd>(a)) {} - inline explicit small_vector_base(maybe_initial_capacity_t, std::size_t initial_capacity, std::size_t initial_size) + template<class AllocFwd> + inline explicit small_vector_base(initial_capacity_t, size_type capacity, BOOST_FWD_REF(AllocFwd) a, small_vector_base &x) + : base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward<AllocFwd>(a), x) + {} + + inline explicit small_vector_base(maybe_initial_capacity_t, size_type initial_capacity, size_type initial_size) : base_type( maybe_initial_capacity_t() , (initial_capacity >= initial_size) ? this->internal_storage() : pointer() , (initial_capacity >= initial_size) ? initial_capacity : initial_size @@ -397,7 +406,7 @@ class small_vector_base {} template<class AllocFwd> - inline explicit small_vector_base(maybe_initial_capacity_t, std::size_t initial_capacity, std::size_t initial_size, BOOST_FWD_REF(AllocFwd) a) + inline explicit small_vector_base(maybe_initial_capacity_t, size_type initial_capacity, size_type initial_size, BOOST_FWD_REF(AllocFwd) a) : base_type(maybe_initial_capacity_t() , (initial_capacity >= initial_size) ? this->internal_storage() : pointer() , (initial_capacity >= initial_size) ? initial_capacity : initial_size @@ -405,11 +414,17 @@ class small_vector_base ) {} + void prot_shrink_to_fit_small(const size_type small_capacity) + { this->base_type::prot_shrink_to_fit_small(this->internal_storage(), small_capacity); } + using base_type::protected_set_size; //~small_vector_base(){} #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + inline void prot_swap(small_vector_base& other, size_type internal_capacity_value) + { this->base_type::prot_swap_small(other, internal_capacity_value); } + public: inline small_vector_base& operator=(BOOST_COPY_ASSIGN_REF(small_vector_base) other) { return static_cast<small_vector_base&>(this->base_type::operator=(static_cast<base_type const&>(other))); } @@ -418,24 +433,8 @@ class small_vector_base { return static_cast<small_vector_base&>(this->base_type::operator=(BOOST_MOVE_BASE(base_type, other))); } inline void swap(small_vector_base &other) - { return this->base_type::swap(other); } + { return this->base_type::prot_swap_small(other, 0u); } - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - protected: - void move_construct_impl(base_type &x) - { - if(base_type::is_propagable_from(x.get_stored_allocator(), x.data(), this->base_type::get_stored_allocator(), true)){ - this->steal_resources(x); - } - else{ - const typename base_type::size_type sz = x.size(); - ::boost::container::uninitialized_move_alloc_n_source - (this->base_type::get_stored_allocator(), x.begin(), sz, this->begin()); - this->protected_set_size(sz); - x.clear(); - } - } - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -449,7 +448,7 @@ template<class T, std::size_t N, class Options> struct small_vector_storage_definer { typedef typename dtl::get_small_vector_opt<Options>::type options_t; - static const std::size_t final_alignment = + BOOST_STATIC_CONSTEXPR std::size_t final_alignment = options_t::inplace_alignment ? options_t::inplace_alignment : dtl::alignment_of<T>::value; typedef small_vector_storage<T, N, final_alignment> type; }; @@ -488,7 +487,7 @@ template<class T, class VoidAlloc, class Options> inline typename small_vector_allocator<T, VoidAlloc, Options>::const_pointer small_vector_allocator<T, VoidAlloc, Options>::internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW { - const vector_type& v = reinterpret_cast<const vector_type&>(*this); + const vector_type& v = *static_cast<const vector_type*>(static_cast<const void *>(this)); BOOST_ASSERT((std::size_t(this) % dtl::alignment_of< small_vector_storage_offset<T, allocator_type, Options> >::value) == 0); const char *addr = reinterpret_cast<const char*>(&v); typedef typename boost::intrusive::pointer_traits<pointer>::template rebind_pointer<const char>::type const_char_pointer; @@ -501,7 +500,7 @@ template <class T, class VoidAlloc, class Options> inline typename small_vector_allocator<T, VoidAlloc, Options>::pointer small_vector_allocator<T, VoidAlloc, Options>::internal_storage() BOOST_NOEXCEPT_OR_NOTHROW { - vector_type& v = reinterpret_cast<vector_type&>(*this); + vector_type& v = *static_cast<vector_type*>(static_cast<void*>(this)); BOOST_ASSERT((std::size_t(this) % dtl::alignment_of< small_vector_storage_offset<T, allocator_type, Options> >::value) == 0); char* addr = reinterpret_cast<char*>(&v); typedef typename boost::intrusive::pointer_traits<pointer>::template rebind_pointer<char>::type char_pointer; @@ -550,7 +549,7 @@ class small_vector typedef typename base_type::size_type size_type; typedef typename base_type::value_type value_type; - inline static std::size_t internal_capacity() + inline static size_type internal_capacity() { return static_capacity; } typedef allocator_traits<typename base_type::allocator_type> allocator_traits_type; @@ -558,7 +557,7 @@ class small_vector #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED //! @brief The capacity/max size of the container - static const size_type static_capacity = small_vector_storage_definer<T, N, Options>::type::sms_size; + BOOST_STATIC_CONSTEXPR size_type static_capacity = small_vector_storage_definer<T, N, Options>::type::sms_size; public: inline small_vector() @@ -627,17 +626,17 @@ class small_vector { this->assign(other.cbegin(), other.cend()); } inline explicit small_vector(BOOST_RV_REF(base_type) other) - : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator())) - { this->base_type::move_construct_impl(other); } + : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator()), other) + {} inline small_vector(BOOST_RV_REF(small_vector) other) BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<value_type>::value) - : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator())) - { this->base_type::move_construct_impl(other); } + : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator()), other) + {} inline small_vector(BOOST_RV_REF(small_vector) other, const allocator_type &a) - : base_type(initial_capacity_t(), internal_capacity(), a) - { this->base_type::move_construct_impl(other); } + : base_type(initial_capacity_t(), internal_capacity(), a, other) + {} #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) inline small_vector(std::initializer_list<value_type> il, const allocator_type& a = allocator_type()) @@ -663,7 +662,10 @@ class small_vector { return static_cast<small_vector&>(this->base_type::operator=(boost::move(other))); } inline void swap(small_vector &other) - { return this->base_type::swap(other); } + { return this->base_type::prot_swap(other, static_capacity); } + + inline void shrink_to_fit() + { this->base_type::prot_shrink_to_fit_small(this->internal_capacity()); } }; }} @@ -678,7 +680,7 @@ template <class T, class Allocator> struct has_trivial_destructor_after_move<boost::container::vector<T, Allocator> > { typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value && + BOOST_STATIC_CONSTEXPR bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value && ::boost::has_trivial_destructor_after_move<pointer>::value; }; diff --git a/contrib/restricted/boost/container/include/boost/container/uses_allocator.hpp b/contrib/restricted/boost/container/include/boost/container/uses_allocator.hpp index e0e3518081..11915e645d 100644 --- a/contrib/restricted/boost/container/include/boost/container/uses_allocator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/uses_allocator.hpp @@ -58,7 +58,7 @@ namespace container { //! to detect if a type should be constructed with suffix or prefix allocator arguments. template <class T> struct constructible_with_allocator_suffix -{ static const bool value = false; }; +{ BOOST_STATIC_CONSTEXPR bool value = false; }; //! <b>Remark</b>: if a specialization constructible_with_allocator_prefix<X>::value is true, indicates that T may be constructed //! with allocator_arg and T::allocator_type as its first two constructor arguments. @@ -108,7 +108,7 @@ struct constructible_with_allocator_suffix //! to detect if a type should be constructed with suffix or prefix allocator arguments. template <class T> struct constructible_with_allocator_prefix -{ static const bool value = false; }; +{ BOOST_STATIC_CONSTEXPR bool value = false; }; #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -142,7 +142,7 @@ struct uses_allocator_imp static Allocator alloc; // Declared but not defined public: - static const bool value = sizeof(test<T>(alloc)) == sizeof(yes_type); + BOOST_STATIC_CONSTEXPR bool value = sizeof(test<T>(alloc)) == sizeof(yes_type); }; } //namespace dtl { diff --git a/contrib/restricted/boost/container/include/boost/container/vector.hpp b/contrib/restricted/boost/container/include/boost/container/vector.hpp index 503a80ba3d..091417620f 100644 --- a/contrib/restricted/boost/container/include/boost/container/vector.hpp +++ b/contrib/restricted/boost/container/include/boost/container/vector.hpp @@ -51,6 +51,7 @@ #include <boost/move/iterator.hpp> #include <boost/move/traits.hpp> #include <boost/move/utility_core.hpp> +#include <boost/move/detail/launder.hpp> // move/detail #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include <boost/move/detail/fwd_macros.hpp> @@ -268,15 +269,15 @@ inline Pointer &get_ptr(vec_iterator<Pointer, IsConst> &it) BOOST_NOEXCEPT_OR_NO struct initial_capacity_t {}; struct vector_uninitialized_size_t {}; -static const vector_uninitialized_size_t vector_uninitialized_size = vector_uninitialized_size_t(); +BOOST_CONTAINER_CONSTANT_VAR vector_uninitialized_size_t vector_uninitialized_size = vector_uninitialized_size_t(); struct maybe_initial_capacity_t {}; template <class T> struct vector_value_traits_base { - static const bool trivial_dctr = dtl::is_trivially_destructible<T>::value; - static const bool trivial_dctr_after_move = has_trivial_destructor_after_move<T>::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr = dtl::is_trivially_destructible<T>::value; + BOOST_STATIC_CONSTEXPR bool trivial_dctr_after_move = has_trivial_destructor_after_move<T>::value; }; template <class Allocator> @@ -351,23 +352,23 @@ struct vector_alloc_holder public: - inline - static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc, bool const propagate_allocator) + template <bool PropagateAllocator> + inline static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc) { - (void)propagate_allocator; (void)p; (void)to_alloc; (void)from_alloc; + (void)p; (void)to_alloc; (void)from_alloc; const bool all_storage_propagable = !allocator_traits_type::is_partially_propagable::value || !allocator_traits_type::storage_is_unpropagable(from_alloc, p); return all_storage_propagable && - (propagate_allocator || allocator_traits_type::is_always_equal::value || allocator_traits_type::equal(from_alloc, to_alloc)); + (PropagateAllocator || allocator_traits_type::is_always_equal::value || allocator_traits_type::equal(from_alloc, to_alloc)); } - inline - static bool are_swap_propagable(const allocator_type &l_a, pointer l_p, const allocator_type &r_a, pointer r_p, bool const propagate_allocator) + template <bool PropagateAllocator> + inline static bool are_swap_propagable(const allocator_type &l_a, pointer l_p, const allocator_type &r_a, pointer r_p) { - (void)propagate_allocator; (void)l_p; (void)r_p; (void)l_a; (void)r_a; + (void)l_p; (void)r_p; (void)l_a; (void)r_a; const bool all_storage_propagable = !allocator_traits_type::is_partially_propagable::value || !(allocator_traits_type::storage_is_unpropagable(l_a, l_p) || allocator_traits_type::storage_is_unpropagable(r_a, r_p)); - return all_storage_propagable && (propagate_allocator || allocator_traits_type::equal(l_a, r_a)); + return all_storage_propagable && (PropagateAllocator || allocator_traits_type::is_always_equal::value || allocator_traits_type::equal(l_a, r_a)); } //Constructor, does not throw @@ -545,7 +546,7 @@ struct vector_alloc_holder inline const allocator_type &alloc() const BOOST_NOEXCEPT_OR_NOTHROW { return *this; } - inline const pointer &start() const BOOST_NOEXCEPT_OR_NOTHROW + inline pointer start() const BOOST_NOEXCEPT_OR_NOTHROW { return m_start; } inline size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return m_capacity; } @@ -837,14 +838,14 @@ private: protected: - inline - static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc, bool const propagate_allocator) - { return alloc_holder_t::is_propagable_from(from_alloc, p, to_alloc, propagate_allocator); } + template <bool PropagateAllocator> + inline static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc) + { return alloc_holder_t::template is_propagable_from<PropagateAllocator>(from_alloc, p, to_alloc); } - inline - static bool are_swap_propagable( const allocator_type &l_a, pointer l_p - , const allocator_type &r_a, pointer r_p, bool const propagate_allocator) - { return alloc_holder_t::are_swap_propagable(l_a, l_p, r_a, r_p, propagate_allocator); } + template <bool PropagateAllocator> + inline static bool are_swap_propagable( const allocator_type &l_a, pointer l_p + , const allocator_type &r_a, pointer r_p) + { return alloc_holder_t::template are_swap_propagable<PropagateAllocator>(l_a, l_p, r_a, r_p); } #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -866,6 +867,25 @@ private: : m_holder(initial_capacity_t(), initial_memory, cap, ::boost::forward<AllocFwd>(a)) {} + template<class AllocFwd> + inline vector(initial_capacity_t, pointer initial_memory, size_type cap, BOOST_FWD_REF(AllocFwd) a, vector &x) + : m_holder(initial_capacity_t(), initial_memory, cap, ::boost::forward<AllocFwd>(a)) + { + allocator_type &this_al = this->get_stored_allocator(); + if (this->template is_propagable_from<true>(x.get_stored_allocator(), x.data(), this_al)) { + this->steal_resources(x); + } + else { + const size_type sz = x.size(); + ::boost::container::uninitialized_move_alloc_n_source + ( this_al, x.priv_raw_begin(), sz + //Use launder to stop false positives from -Warray-bounds + , boost::move_detail::launder(this->priv_raw_begin())); + this->protected_set_size(sz); + x.clear(); + } + } + inline vector(initial_capacity_t, pointer initial_memory, size_type cap) : m_holder(initial_capacity_t(), initial_memory, cap) {} @@ -1163,11 +1183,11 @@ private: vector(BOOST_RV_REF(vector) x, const allocator_type &a) : m_holder( vector_uninitialized_size, a //In this allocator move constructor the allocator won't be propagated --v - , is_propagable_from(x.get_stored_allocator(), x.m_holder.start(), a, false) ? 0 : x.size() + , is_propagable_from<false>(x.get_stored_allocator(), x.m_holder.start(), a) ? 0 : x.size() ) { //In this allocator move constructor the allocator won't be propagated ---v - if(is_propagable_from(x.get_stored_allocator(), x.m_holder.start(), a, false)){ + if(is_propagable_from<false>(x.get_stored_allocator(), x.m_holder.start(), a)){ this->m_holder.steal_resources(x.m_holder); } else{ @@ -2228,7 +2248,7 @@ private: #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - //! <b>Effects</b>: Erases all the elements of the vector. + //! <b>Effects</b>: Erases all the elements of the vector. Leaves the capacity() of the vector unchanged. //! //! <b>Throws</b>: Nothing. //! @@ -2532,6 +2552,38 @@ private: } template<class OtherA> + void priv_move_assign_steal_or_assign(BOOST_RV_REF_BEG vector<T, OtherA, Options> BOOST_RV_REF_END x, dtl::true_type /*data_can_be_always_stolen*/) + { + this->clear(); + if (BOOST_LIKELY(!!this->m_holder.m_start)) + this->m_holder.deallocate(this->m_holder.m_start, this->m_holder.m_capacity); + this->m_holder.steal_resources(x.m_holder); + } + + template<class OtherA> + void priv_move_assign_steal_or_assign(BOOST_RV_REF_BEG vector<T, OtherA, Options> BOOST_RV_REF_END x, dtl::false_type /*data_can_be_always_stolen*/) + { + const bool propagate_alloc = allocator_traits_type::propagate_on_container_move_assignment::value; + allocator_type& this_alloc = this->m_holder.alloc(); + allocator_type& x_alloc = x.m_holder.alloc(); + + //In this allocator move constructor the allocator might will be propagated, but to support small_vector-like + //types, we need to check the currently owned buffers to know if they are propagable. + const bool is_buffer_propagable_from_x = is_propagable_from<propagate_alloc>(x_alloc, x.m_holder.start(), this_alloc); + + if (is_buffer_propagable_from_x) { + this->priv_move_assign_steal_or_assign(boost::move(x), dtl::true_type()); + } + //Else do a one by one move. Also, clear the source as users find confusing + //elements are still alive in the source container. + else { + this->assign( boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.begin())) + , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.end())) ); + x.clear(); + } + } + + template<class OtherA> void priv_move_assign(BOOST_RV_REF_BEG vector<T, OtherA, Options> BOOST_RV_REF_END x , typename dtl::disable_if_or < void @@ -2542,30 +2594,16 @@ private: //for move assignment, no aliasing (&x != this) is assumed. //x.size() == 0 is allowed for buggy std libraries. BOOST_ASSERT(this != &x || x.size() == 0); - allocator_type &this_alloc = this->m_holder.alloc(); - allocator_type &x_alloc = x.m_holder.alloc(); + const bool alloc_is_always_equal = allocator_traits_type::is_always_equal::value; const bool propagate_alloc = allocator_traits_type::propagate_on_container_move_assignment::value; + const bool partially_propagable_alloc = allocator_traits_type::is_partially_propagable::value; + const bool data_can_be_always_be_stolen = alloc_is_always_equal || (propagate_alloc && !partially_propagable_alloc); - //In this allocator move constructor the allocator maybe will be propagated -----------------------v - const bool is_propagable_from_x = is_propagable_from(x_alloc, x.m_holder.start(), this_alloc, propagate_alloc); + this->priv_move_assign_steal_or_assign(boost::move(x), dtl::bool_<data_can_be_always_be_stolen>()); - //Resources can be transferred if both allocators are - //going to be equal after this function (either propagated or already equal) - if(is_propagable_from_x){ - this->clear(); - if(BOOST_LIKELY(!!this->m_holder.m_start)) - this->m_holder.deallocate(this->m_holder.m_start, this->m_holder.m_capacity); - this->m_holder.steal_resources(x.m_holder); - } - //Else do a one by one move. Also, clear the source as users find confusing - //elements are still alive in the source container. - else{ - this->assign( boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.begin())) - , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.end() )) - ); - x.clear(); - } //Move allocator if needed + allocator_type& this_alloc = this->m_holder.alloc(); + allocator_type& x_alloc = x.m_holder.alloc(); dtl::move_alloc(this_alloc, x_alloc, dtl::bool_<propagate_alloc>()); } @@ -2613,46 +2651,115 @@ private: template<class Vector> //Template it to avoid it in explicit instantiations void priv_swap(Vector &x, dtl::false_type) //version_N { - const bool propagate_alloc = allocator_traits_type::propagate_on_container_swap::value; + BOOST_ASSERT(allocator_traits_type::propagate_on_container_swap::value || + allocator_traits_type::is_always_equal::value || + this->get_stored_allocator() == x.get_stored_allocator()); + + if (BOOST_UNLIKELY(&x == this)) { + return; + } + + //Just swap internals + this->m_holder.swap_resources(x.m_holder); + //And now swap the allocator + dtl::bool_<allocator_traits_type::propagate_on_container_swap::value> flag; + dtl::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), flag); + } + + protected: + template<class Vector> //Template it to avoid it in explicit instantiations + void prot_swap_small(Vector &x, std::size_t internal_capacity) //version_N + { if (BOOST_UNLIKELY(&x == this)){ return; } - else if(are_swap_propagable( this->get_stored_allocator(), this->m_holder.start() - , x.get_stored_allocator(), x.m_holder.start(), propagate_alloc)){ - //Just swap internals - this->m_holder.swap_resources(x.m_holder); + + const bool propagate_alloc = allocator_traits_type::propagate_on_container_swap::value; + if(are_swap_propagable<propagate_alloc> + ( this->get_stored_allocator(), this->m_holder.start(), x.get_stored_allocator(), x.m_holder.start())){ + this->priv_swap(x, dtl::false_()); + return; } - else{ - //Else swap element by element... + + allocator_type &th_al = this->get_stored_allocator(); + allocator_type &ot_al = x.get_stored_allocator(); + + const bool is_this_data_propagable = is_propagable_from<propagate_alloc>(th_al, this->data(), ot_al); + const bool is_that_data_propagable = is_propagable_from<propagate_alloc>(ot_al, x.data(), th_al); + + if(internal_capacity && (is_this_data_propagable || is_that_data_propagable)) { + //steal memory from src to dst, but move elements from dst to src + vector& extmem = is_this_data_propagable ? *this : x; + vector& intmem = is_this_data_propagable ? x : *this; + + //Reset extmem to the internal storage and backup data + pointer const orig_extdata = extmem.data(); + const size_type orig_extmem_size = extmem.size(); + const size_type orig_extmem_cap = extmem.capacity(); + + //New safe state for extmem -> empty, internal storage + extmem.m_holder.m_start = extmem.get_stored_allocator().internal_storage(); + extmem.m_holder.set_stored_size(0u); + extmem.m_holder.set_stored_capacity(internal_capacity); + + { + //Deallocate on exception + typename value_traits::ArrayDeallocator new_buffer_deallocator(orig_extdata, extmem.get_stored_allocator(), orig_extmem_cap); + typename value_traits::ArrayDestructor new_values_destroyer(orig_extdata, extmem.get_stored_allocator(), orig_extmem_size); + + //Move internal memory data to the internal memory data of the target, this can throw + BOOST_ASSERT(extmem.capacity() >= intmem.size()); + ::boost::container::uninitialized_move_alloc_n + (intmem.get_stored_allocator(), this->priv_raw_begin(), intmem.size(), extmem.priv_raw_begin()); + + //Exception not thrown, commit new state + extmem.m_holder.set_stored_size(intmem.size()); + //Throwing part passed, disable rollback + new_buffer_deallocator.release(); + new_values_destroyer.release(); + } + + //Destroy moved elements from intmem + boost::container::destroy_alloc_n + ( intmem.get_stored_allocator(), this->priv_raw_begin() + , intmem.size()); + + //Adopt dynamic buffer + intmem.m_holder.m_start = orig_extdata; + intmem.m_holder.set_stored_size(orig_extmem_size); + intmem.m_holder.set_stored_capacity(orig_extmem_cap); + + //And now swap the allocator + dtl::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), dtl::bool_<propagate_alloc>()); + } + else { //swap element by element and insert rest bool const t_smaller = this->size() < x.size(); vector &sml = t_smaller ? *this : x; vector &big = t_smaller ? x : *this; - //For empty containers, maybe storage can be moved from the other (just like in the move constructor) - if(sml.empty() && is_propagable_from(big.get_stored_allocator(), big.data(), sml.get_allocator(), propagate_alloc)){ - if(BOOST_LIKELY(0u != sml.capacity())) - sml.m_holder.deallocate(sml.m_holder.m_start, sml.m_holder.m_capacity); - sml.steal_resources(big); - } - else { - //Else swap element by element... - size_type const common_elements = sml.size(); - for(size_type i = 0; i != common_elements; ++i){ - boost::adl_move_swap(sml[i], big[i]); - } - //... and move-insert the remaining range - sml.insert( sml.cend() - , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(big.nth(common_elements))) - , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(big.end())) - ); - //Destroy remaining elements - big.erase(big.nth(common_elements), big.cend()); + //swap element by element until common size + size_type const common_elements = sml.size(); + for(size_type i = 0; i != common_elements; ++i){ + boost::adl_move_swap(sml[i], big[i]); } + + //And now swap the allocator to be able to construct new elements in sml with the proper allocator + dtl::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), dtl::bool_<propagate_alloc>()); + + //move-insert the remaining range + T *const raw_big_nth = boost::movelib::iterator_to_raw_pointer(big.nth(common_elements)); + sml.insert(sml.cend() + , boost::make_move_iterator(raw_big_nth) + , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(big.end()))); + + //Destroy remaining, moved, elements with their original allocator + boost::container::destroy_alloc_n + ( sml.get_stored_allocator(), raw_big_nth + , std::size_t(big.m_holder.m_size - common_elements)); + big.m_holder.set_stored_size(common_elements); } - //And now swap the allocator - dtl::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), dtl::bool_<propagate_alloc>()); } - + private: inline void priv_move_to_new_buffer(size_type, version_0) { alloc_holder_t::on_capacity_overflow(); } @@ -2762,6 +2869,41 @@ private: inline dtl::insert_value_initialized_n_proxy<allocator_type> priv_resize_proxy(value_init_t) { return dtl::insert_value_initialized_n_proxy<allocator_type>(); } + protected: + void prot_shrink_to_fit_small(pointer const small_buffer, const size_type small_capacity) + { + const size_type cp = this->m_holder.capacity(); + if (cp && this->m_holder.m_start != small_buffer) { //Do something only if a dynamic buffer is used + const size_type sz = this->size(); + if (!sz) { + if (BOOST_LIKELY(!!this->m_holder.m_start)) + this->m_holder.deallocate(this->m_holder.m_start, cp); + this->m_holder.m_start = small_buffer; + this->m_holder.set_stored_capacity(small_capacity); + } + else if(sz <= small_capacity) { + T *const oldbuf = boost::movelib::to_raw_pointer(this->m_holder.m_start); + ::boost::container::uninitialized_move_alloc_n + ( this->get_stored_allocator() + , oldbuf + , sz + , boost::movelib::to_raw_pointer(small_buffer) + ); + boost::container::destroy_alloc_n(this->get_stored_allocator(), oldbuf, sz); + + if (BOOST_LIKELY(!!this->m_holder.m_start)) + this->m_holder.deallocate(this->m_holder.m_start, cp); + + this->m_holder.m_start = small_buffer; + this->m_holder.set_stored_capacity(small_capacity); + } + else if (sz < cp) { + this->priv_move_to_new_buffer(sz, alloc_version()); + } + } + } + + private: inline void priv_shrink_to_fit(version_0) BOOST_NOEXCEPT_OR_NOTHROW {} @@ -2807,12 +2949,19 @@ private: } } + #ifdef _MSC_VER + #pragma warning (push) + #pragma warning(disable: 4702) //Disable unreachable code warning + #endif template <class InsertionProxy> inline iterator priv_insert_forward_range_no_capacity (T * const, const size_type, const InsertionProxy , version_0) { return alloc_holder_t::on_capacity_overflow(), iterator(); } + #ifdef _MSC_VER + #pragma warning (pop) + #endif template <class InsertionProxy> BOOST_CONTAINER_NOINLINE iterator priv_insert_forward_range_no_capacity @@ -3161,8 +3310,8 @@ struct has_trivial_destructor_after_move<boost::container::vector<T, Allocator, { typedef typename boost::container::vector<T, Allocator, Options>::allocator_type allocator_type; typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<allocator_type>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value; + BOOST_STATIC_CONSTEXPR bool value = ::boost::has_trivial_destructor_after_move<allocator_type>::value && + ::boost::has_trivial_destructor_after_move<pointer>::value; }; } diff --git a/contrib/restricted/boost/container/ya.make b/contrib/restricted/boost/container/ya.make index 37dd4b3f04..4ebf93e111 100644 --- a/contrib/restricted/boost/container/ya.make +++ b/contrib/restricted/boost/container/ya.make @@ -9,16 +9,15 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.85.0) +VERSION(1.86.0) -ORIGINAL_SOURCE(https://github.com/boostorg/container/archive/boost-1.85.0.tar.gz) +ORIGINAL_SOURCE(https://github.com/boostorg/container/archive/boost-1.86.0.tar.gz) PEERDIR( contrib/restricted/boost/assert contrib/restricted/boost/config contrib/restricted/boost/intrusive contrib/restricted/boost/move - contrib/restricted/boost/static_assert ) ADDINCL( diff --git a/contrib/restricted/boost/move/include/boost/move/detail/launder.hpp b/contrib/restricted/boost/move/include/boost/move/detail/launder.hpp new file mode 100644 index 0000000000..a6236de950 --- /dev/null +++ b/contrib/restricted/boost/move/include/boost/move/detail/launder.hpp @@ -0,0 +1,53 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_MOVE_DETAIL_LAUNDER_HPP +#define BOOST_MOVE_DETAIL_LAUNDER_HPP + +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include <boost/move/detail/workaround.hpp> + +namespace boost { +namespace move_detail { + +#if defined(BOOST_MOVE_HAS_BUILTIN_LAUNDER) + +template<class T> +BOOST_MOVE_FORCEINLINE T* launder(T* p) +{ + return __builtin_launder( p ); +} + +#else + +template<class T> +BOOST_MOVE_FORCEINLINE T* launder(T* p) +{ + return p; +} + +#endif + +template<class T> +BOOST_MOVE_FORCEINLINE T launder_cast(const volatile void* p) +{ + return (launder)((T)p); +} + +} //namespace move_detail { +} //namespace boost { + +#endif //#ifndef BOOST_MOVE_DETAIL_LAUNDER_HPP |