diff --git a/doc/interprocess.qbk b/doc/interprocess.qbk index ea25a1e..8401812 100644 --- a/doc/interprocess.qbk +++ b/doc/interprocess.qbk @@ -6762,6 +6762,12 @@ thank them: [section:release_notes Release Notes] +[section:release_notes_boost_1_67_00 Boost 1.67 Release] +* Fixed bugs: + * [@https://github.com/boostorg/interprocess/pull/45 GitHub Pull #45 (['"Make intrusive_ptr move constructible/assignable"])]. + +[endsect] + [section:release_notes_boost_1_66_00 Boost 1.66 Release] * Fixed bugs: * [@https://github.com/boostorg/interprocess/pull/41 GitHub Pull #41 (['"Data race in boost::interprocess::rbtree_best_fit"])]. diff --git a/include/boost/interprocess/detail/named_proxy.hpp b/include/boost/interprocess/detail/named_proxy.hpp index 4bec375..f3eb61d 100644 --- a/include/boost/interprocess/detail/named_proxy.hpp +++ b/include/boost/interprocess/detail/named_proxy.hpp @@ -274,7 +274,7 @@ class named_proxy T *operator()( BOOST_MOVE_UREF##N ) const\ {\ typedef typename if_c \ + , CtorIt##N \ , CtorArg##N \ >::type ctor_obj_t;\ ctor_obj_t ctor_obj = ctor_obj_t( BOOST_MOVE_FWD##N );\ diff --git a/include/boost/interprocess/detail/transform_iterator.hpp b/include/boost/interprocess/detail/transform_iterator.hpp index 1c4dcd3..d409b52 100644 --- a/include/boost/interprocess/detail/transform_iterator.hpp +++ b/include/boost/interprocess/detail/transform_iterator.hpp @@ -27,170 +27,14 @@ // interprocess #include -// interprocess/detail -#include -// move/detail -#include +// container/detail +#include namespace boost { namespace interprocess { -template -struct operator_arrow_proxy -{ - operator_arrow_proxy(const PseudoReference &px) - : m_value(px) - {} - - PseudoReference* operator->() const { return &m_value; } - // This function is needed for MWCW and BCC, which won't call operator-> - // again automatically per 13.3.1.2 para 8 -// operator T*() const { return &m_value; } - mutable PseudoReference m_value; -}; - -template -struct operator_arrow_proxy -{ - operator_arrow_proxy(T &px) - : m_value(px) - {} - - T* operator->() const { return const_cast(&m_value); } - // This function is needed for MWCW and BCC, which won't call operator-> - // again automatically per 13.3.1.2 para 8 -// operator T*() const { return &m_value; } - T &m_value; -}; - -template -class transform_iterator - : public UnaryFunction -{ - public: - typedef typename ::boost::container::iterator_traits::iterator_category iterator_category; - typedef typename ipcdetail::remove_reference::type value_type; - typedef typename ::boost::container::iterator_traits::difference_type difference_type; - typedef operator_arrow_proxy pointer; - typedef typename UnaryFunction::result_type reference; - - explicit transform_iterator(const Iterator &it, const UnaryFunction &f = UnaryFunction()) - : UnaryFunction(f), m_it(it) - {} - - explicit transform_iterator() - : UnaryFunction(), m_it() - {} - - //Constructors - transform_iterator& operator++() - { increment(); return *this; } - - transform_iterator operator++(int) - { - transform_iterator result (*this); - increment(); - return result; - } - - transform_iterator& operator--() - { decrement(); return *this; } - - transform_iterator operator--(int) - { - transform_iterator result (*this); - decrement(); - return result; - } - - friend bool operator== (const transform_iterator& i, const transform_iterator& i2) - { return i.equal(i2); } - - 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; } - - 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); } - - friend difference_type operator- (const transform_iterator& i, const transform_iterator& i2) - { return i2.distance_to(i); } - - //Arithmetic - transform_iterator& operator+=(difference_type off) - { this->advance(off); return *this; } - - transform_iterator operator+(difference_type off) const - { - transform_iterator other(*this); - other.advance(off); - return other; - } - - friend transform_iterator operator+(difference_type off, const transform_iterator& right) - { return right + off; } - - transform_iterator& operator-=(difference_type off) - { this->advance(-off); return *this; } - - transform_iterator operator-(difference_type off) const - { return *this + (-off); } - - typename UnaryFunction::result_type operator*() const - { return dereference(); } - - typename UnaryFunction::result_type operator[](difference_type off) const - { return UnaryFunction::operator()(m_it[off]); } - - operator_arrow_proxy - operator->() const - { return operator_arrow_proxy(dereference()); } - - Iterator & base() - { return m_it; } - - const Iterator & base() const - { return m_it; } - - private: - Iterator m_it; - - void increment() - { ++m_it; } - - void decrement() - { --m_it; } - - bool equal(const transform_iterator &other) const - { return m_it == other.m_it; } - - bool less(const transform_iterator &other) const - { return other.m_it < m_it; } - - typename UnaryFunction::result_type dereference() const - { return UnaryFunction::operator()(*m_it); } - - void advance(difference_type n) - { ::boost::container::iterator_advance(m_it, n); } - - difference_type distance_to(const transform_iterator &other)const - { return ::boost::container::iterator_distance(other.m_it, m_it); } -}; - -template -transform_iterator -make_transform_iterator(Iterator it, UnaryFunc fun) -{ - return transform_iterator(it, fun); -} +using boost::container::make_transform_iterator; +using boost::container::transform_iterator; } //namespace interprocess { } //namespace boost { diff --git a/include/boost/interprocess/segment_manager.hpp b/include/boost/interprocess/segment_manager.hpp index d00f177..8e2221e 100644 --- a/include/boost/interprocess/segment_manager.hpp +++ b/include/boost/interprocess/segment_manager.hpp @@ -630,7 +630,7 @@ class segment_manager //!the named allocations performed in this segment manager const_named_iterator named_begin() const { - return make_transform_iterator + return (make_transform_iterator) (m_header.m_named_index.begin(), named_transform()); } @@ -638,7 +638,7 @@ class segment_manager //!the named allocations performed in this segment manager const_named_iterator named_end() const { - return make_transform_iterator + return (make_transform_iterator) (m_header.m_named_index.end(), named_transform()); } @@ -646,7 +646,7 @@ class segment_manager //!the unique allocations performed in this segment manager const_unique_iterator unique_begin() const { - return make_transform_iterator + return (make_transform_iterator) (m_header.m_unique_index.begin(), unique_transform()); } @@ -654,7 +654,7 @@ class segment_manager //!the unique allocations performed in this segment manager const_unique_iterator unique_end() const { - return make_transform_iterator + return (make_transform_iterator) (m_header.m_unique_index.end(), unique_transform()); } diff --git a/test/shared_ptr_test.cpp b/test/shared_ptr_test.cpp index 5bdfd93..b523acc 100644 --- a/test/shared_ptr_test.cpp +++ b/test/shared_ptr_test.cpp @@ -48,10 +48,9 @@ class derived_class int simple_test() { - typedef allocator - base_class_allocator; - typedef deleter - base_deleter_t; + typedef managed_shared_memory::segment_manager segment_mngr_t; + typedef allocator base_class_allocator; + typedef deleter base_deleter_t; typedef shared_ptr base_shared_ptr; std::string process_name; @@ -97,35 +96,31 @@ int simple_test() int string_shared_ptr_vector_insertion_test() { + typedef managed_shared_memory::segment_manager segment_mngr_t; + //Allocator of chars - typedef allocator - char_allocator_t; + typedef allocator char_allocator_t; //A shared memory string class - typedef basic_string, - char_allocator_t> string_t; + typedef basic_string, char_allocator_t> string_t; //A shared memory string allocator - typedef allocator - string_allocator_t; + typedef allocator string_allocator_t; //A deleter for shared_ptr<> that erases a shared memory string - typedef deleter - string_deleter_t; + typedef deleter string_deleter_t; //A shared pointer that points to a shared memory string and its instantiation typedef shared_ptr string_shared_ptr_t; //An allocator for shared pointers to a string in shared memory - typedef allocator - string_shared_ptr_allocator_t; + typedef allocator string_shared_ptr_allocator_t; //A weak pointer that points to a shared memory string and its instantiation typedef weak_ptr string_weak_ptr_t; //An allocator for weak pointers to a string in shared memory - typedef allocator - string_weak_ptr_allocator_t; + typedef allocator string_weak_ptr_allocator_t; //A vector of shared pointers to strings (all in shared memory) and its instantiation typedef vector @@ -156,8 +151,7 @@ int string_shared_ptr_vector_insertion_test() //Create a string in shared memory, to avoid leaks with exceptions use //scoped ptr until we store this pointer in the shared ptr scoped_ptr scoped_string - (shmem.construct(anonymous_instance)(string_allocator), - deleter); + (shmem.construct(anonymous_instance)(string_allocator), deleter); //Now construct a shared pointer to a string string_shared_ptr_t string_shared_ptr (scoped_string.get(), string_shared_ptr_allocator, @@ -262,6 +256,7 @@ int string_shared_ptr_vector_insertion_test() shared_memory_object::remove(process_name.c_str()); return 0; } + // // This part is taken from shared_ptr_basic_test.cpp // @@ -402,21 +397,13 @@ void test_is_nonzero(shared_ptr const & p) int basic_shared_ptr_test() { - typedef allocator - v_allocator_t; - - typedef deleter - x_deleter_t; - - typedef deleter - y_deleter_t; - + typedef managed_shared_memory::segment_manager segment_mngr_t; + typedef allocator v_allocator_t; + typedef deleter x_deleter_t; + typedef deleter y_deleter_t; typedef shared_ptr x_shared_ptr; - typedef shared_ptr y_shared_ptr; - typedef weak_ptr x_weak_ptr; - typedef weak_ptr y_weak_ptr; std::string process_name; @@ -557,11 +544,9 @@ struct alias_tester void test_alias() { - typedef allocator - v_allocator_t; - - typedef deleter - int_deleter_t; + typedef managed_shared_memory::segment_manager segment_mngr_t; + typedef allocator v_allocator_t; + typedef deleter int_deleter_t; typedef shared_ptr int_shared_ptr; typedef shared_ptr const_int_shared_ptr;