diff --git a/doc/move.qbk b/doc/move.qbk index e1d61ae..99f2f3d 100644 --- a/doc/move.qbk +++ b/doc/move.qbk @@ -129,9 +129,12 @@ Consider a simple handle class that owns a resource and also provides copy seman clone_ptr& operator=(clone_ptr&& p) { - std::swap(ptr, p.ptr); - delete p.ptr; - p.ptr = 0; + if(this != &p) + { + std::swap(ptr, p.ptr); + delete p.ptr; + p.ptr = 0; + } return *this; } @@ -171,7 +174,7 @@ You just need to follow these simple steps: * Put the following macro in the [*private] section: [macroref BOOST_COPYABLE_AND_MOVABLE BOOST_COPYABLE_AND_MOVABLE(classname)] -* Left copy constructor as is. +* Leave copy constructor as is. * Write a copy assignment taking the parameter as [macroref BOOST_COPY_ASSIGN_REF BOOST_COPY_ASSIGN_REF(classname)] * Write a move constructor and a move assignment taking the parameter as @@ -787,10 +790,18 @@ Many thanks to all boosters that have tested, reviewed and improved the library. [section:release_notes Release Notes] +[section:release_notes_boost_1_55_00 Boost 1.55 Release] + +* Fixed bug [@https://svn.boost.org/trac/boost/ticket/7952 #7952]). + +[endsect] + + [section:release_notes_boost_1_54_00 Boost 1.54 Release] + * Fixed bugs [@https://svn.boost.org/trac/boost/ticket/7969 #7969]), - [@https://svn.boost.org/trac/boost/ticket/8231 #8231]). + [@https://svn.boost.org/trac/boost/ticket/8231 #8231]). [endsect] diff --git a/example/doc_file_descriptor.cpp b/example/doc_file_descriptor.cpp index e4e6ba3..1dd7bc0 100644 --- a/example/doc_file_descriptor.cpp +++ b/example/doc_file_descriptor.cpp @@ -10,6 +10,7 @@ ////////////////////////////////////////////////////////////////////////////// #include +#include //[file_descriptor_def @@ -24,8 +25,8 @@ class file_descriptor return 1; } - void operating_system_close_file(int) - {} + void operating_system_close_file(int fd) + { (void)fd; assert(fd != 0); } //-> int os_descr_; @@ -33,12 +34,12 @@ class file_descriptor BOOST_MOVABLE_BUT_NOT_COPYABLE(file_descriptor) public: - explicit file_descriptor(const char *filename = 0) //Constructor - : os_descr_(filename ? operating_system_open_file(filename) : 0) + explicit file_descriptor(const char *filename) //Constructor + : os_descr_(operating_system_open_file(filename)) { if(!os_descr_) throw std::runtime_error("file not found"); } ~file_descriptor() //Destructor - { if(!os_descr_) operating_system_close_file(os_descr_); } + { if(os_descr_) operating_system_close_file(os_descr_); } file_descriptor(BOOST_RV_REF(file_descriptor) x) // Move ctor : os_descr_(x.os_descr_) @@ -46,7 +47,7 @@ class file_descriptor file_descriptor& operator=(BOOST_RV_REF(file_descriptor) x) // Move assign { - if(!os_descr_) operating_system_close_file(os_descr_); + if(os_descr_) operating_system_close_file(os_descr_); os_descr_ = x.os_descr_; x.os_descr_ = 0; return *this;