Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84546 - in trunk/libs/move: doc example
From: igaztanaga_at_[hidden]
Date: 2013-05-29 06:07:01


Author: igaztanaga
Date: 2013-05-29 06:07:00 EDT (Wed, 29 May 2013)
New Revision: 84546
URL: http://svn.boost.org/trac/boost/changeset/84546

Log:
Fixes #7952
Text files modified:
   trunk/libs/move/doc/move.qbk | 21 ++++++++++++++++-----
   trunk/libs/move/example/doc_file_descriptor.cpp | 13 +++++++------
   2 files changed, 23 insertions(+), 11 deletions(-)

Modified: trunk/libs/move/doc/move.qbk
==============================================================================
--- trunk/libs/move/doc/move.qbk (original)
+++ trunk/libs/move/doc/move.qbk 2013-05-29 06:07:00 EDT (Wed, 29 May 2013)
@@ -129,9 +129,12 @@
 
       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 @@
 
 * 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 @@
 
 [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]
 

Modified: trunk/libs/move/example/doc_file_descriptor.cpp
==============================================================================
--- trunk/libs/move/example/doc_file_descriptor.cpp (original)
+++ trunk/libs/move/example/doc_file_descriptor.cpp 2013-05-29 06:07:00 EDT (Wed, 29 May 2013)
@@ -10,6 +10,7 @@
 //////////////////////////////////////////////////////////////////////////////
 
 #include <boost/move/detail/config_begin.hpp>
+#include <cassert>
 
 //[file_descriptor_def
 
@@ -24,8 +25,8 @@
       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 @@
    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 @@
 
    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;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk