diff --git a/doc/container.qbk b/doc/container.qbk index d2fb9a4..541753b 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1246,6 +1246,7 @@ use [*Boost.Container]? There are several reasons for that: * [@https://github.com/boostorg/container/pull/109 GitHub #109: ['"Get rid of integer overflow in copy_move_algo.hpp (-fsanitize=integer)"]]. * [@https://github.com/boostorg/container/pull/110 GitHub #110: ['"Avoid gcc 9 deprecated copy warnings in new_allocator.hpp"]]. * [@https://github.com/boostorg/container/issues/112 GitHub #112: ['"vector::resize() compilation error with msvc-10..12: data is not a member of boost::detail::aligned_storage"]]. + * [@https://github.com/boostorg/container/issues/114 GitHub #114: ['"Fix small_vector noexcept specification"]]. * [@https://github.com/boostorg/container/issues/116 GitHub #116: ['"MSVC + boost 1.70 compilation error when windows.h is already included (detail/thread_mutex.hpp)"]]. * [@https://github.com/boostorg/container/issues/117 GitHub #117: ['"flat_map/map::insert_or_assign with hint has wrong return types"]]. * [@https://github.com/boostorg/container/issues/118 GitHub #118: ['"Non-unique inplace_set_difference used in in flat_tree_merge_unique and iterator invalidation in insert_unique"]]. diff --git a/include/boost/container/small_vector.hpp b/include/boost/container/small_vector.hpp index ac24903..80300af 100644 --- a/include/boost/container/small_vector.hpp +++ b/include/boost/container/small_vector.hpp @@ -74,7 +74,7 @@ namespace container { //! `boost::container::vector< T, small_vector_allocator >` //! and internal storage can be obtained downcasting that vector //! to `small_vector_base`. -template +template class small_vector_allocator : public allocator_traits::type>::template portable_rebind_alloc::type { @@ -86,10 +86,10 @@ class small_vector_allocator BOOST_COPYABLE_AND_MOVABLE(small_vector_allocator) - BOOST_CONTAINER_FORCEINLINE const allocator_type &as_base() const + BOOST_CONTAINER_FORCEINLINE const allocator_type &as_base() const BOOST_NOEXCEPT { return static_cast(*this); } - BOOST_CONTAINER_FORCEINLINE allocator_type &as_base() + BOOST_CONTAINER_FORCEINLINE allocator_type &as_base() BOOST_NOEXCEPT { return static_cast(*this); } #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -127,22 +127,8 @@ class small_vector_allocator typedef typename allocator_traits::template portable_rebind_alloc::type other; }; - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //!Constructor from arbitrary arguments - template - BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_FWD_REF(Args) ...args) - : allocator_type(::boost::forward(args)...) - {} - #else - #define BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_MOVE_UREF##N)\ - : allocator_type(BOOST_MOVE_FWD##N)\ - {}\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE) - #undef BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE - #endif + BOOST_CONTAINER_FORCEINLINE small_vector_allocator() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) + {} //!Constructor from other small_vector_allocator. //!Never throws @@ -174,13 +160,20 @@ class small_vector_allocator : allocator_type(::boost::move(other.as_base())) {} + //!Constructor from allocator_type. + //!Never throws + BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator + (const allocator_type &other) BOOST_NOEXCEPT_OR_NOTHROW + : allocator_type(other) + {} + //!Assignment from other small_vector_allocator. //!Never throws BOOST_CONTAINER_FORCEINLINE small_vector_allocator & operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(this->allocator_type::operator=(other.as_base())); } - //!Move constructor from other small_vector_allocator. + //!Move assignment from other small_vector_allocator. //!Never throws BOOST_CONTAINER_FORCEINLINE small_vector_allocator & operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW @@ -200,6 +193,12 @@ class small_vector_allocator operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(this->allocator_type::operator=(::boost::move(other.as_base()))); } + //!Move assignment from allocator_type. + //!Never throws + BOOST_CONTAINER_FORCEINLINE small_vector_allocator & + operator=(const allocator_type &other) BOOST_NOEXCEPT_OR_NOTHROW + { return static_cast(this->allocator_type::operator=(other)); } + //!Allocates storage from the standard-conforming allocator BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type count, const_void_pointer hint = const_void_pointer()) { return allocator_traits_type::allocate(this->as_base(), count, hint); } @@ -537,7 +536,7 @@ class small_vector : public small_vector_base public: BOOST_CONTAINER_FORCEINLINE small_vector() - BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : base_type(initial_capacity_t(), internal_capacity()) {}