From abc8f80ea6d6be7c748d2ee03860b2d6f0e62cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 29 Aug 2014 14:19:54 +0200 Subject: [PATCH] Remove BOOST_MOVABLE_BUT_NOT_COPYABLE from basic_string_base as it comflicts with is_copy_constructible and other utilities that inspect the internal tag looking for noncopyable types. --- include/boost/container/string.hpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp index 2cbd0bf..2172e0e 100644 --- a/include/boost/container/string.hpp +++ b/include/boost/container/string.hpp @@ -67,11 +67,12 @@ namespace container_detail { template class basic_string_base { - BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_string_base) + basic_string_base & operator=(const basic_string_base &); + basic_string_base(const basic_string_base &); typedef allocator_traits allocator_traits_type; public: - typedef Allocator allocator_type; + typedef Allocator allocator_type; typedef allocator_type stored_allocator_type; typedef typename allocator_traits_type::pointer pointer; typedef typename allocator_traits_type::value_type value_type; @@ -86,6 +87,10 @@ class basic_string_base : members_(a) { init(); } + basic_string_base(BOOST_RV_REF(allocator_type) a) + : members_(boost::move(a)) + { this->init(); } + basic_string_base(const allocator_type& a, size_type n) : members_(a) { @@ -93,13 +98,6 @@ class basic_string_base this->allocate_initial_block(n); } - basic_string_base(BOOST_RV_REF(basic_string_base) b) - : members_(boost::move(b.alloc())) - { - this->init(); - this->swap_data(b); - } - ~basic_string_base() { if(!this->is_short()){ @@ -606,8 +604,15 @@ class basic_string //! //! Complexity: Constant. basic_string(BOOST_RV_REF(basic_string) s) BOOST_CONTAINER_NOEXCEPT - : base_t(boost::move((base_t&)s)) - {} + : base_t(boost::move(s.alloc())) + { + if(s.alloc() == this->alloc()){ + this->swap_data(s); + } + else{ + this->assign(s.begin(), s.end()); + } + } //! Effects: Copy constructs a basic_string using the specified allocator. //!