Boost logo

Boost-Commit :

From: technews_at_[hidden]
Date: 2008-06-25 14:20:32


Author: turkanis
Date: 2008-06-25 14:20:31 EDT (Wed, 25 Jun 2008)
New Revision: 46691
URL: http://svn.boost.org/trac/boost/changeset/46691

Log:
added code to inistialize pimpl_ with a dynamically constructed impl_type in all ctors
Text files modified:
   trunk/boost/iostreams/device/file_descriptor.hpp | 6 +++++-
   trunk/libs/iostreams/src/file_descriptor.cpp | 6 ++++--
   2 files changed, 9 insertions(+), 3 deletions(-)

Modified: trunk/boost/iostreams/device/file_descriptor.hpp
==============================================================================
--- trunk/boost/iostreams/device/file_descriptor.hpp (original)
+++ trunk/boost/iostreams/device/file_descriptor.hpp 2008-06-25 14:20:31 EDT (Wed, 25 Jun 2008)
@@ -74,7 +74,10 @@
     explicit file_descriptor( const Path& path,
                               BOOST_IOS::openmode mode =
                                   BOOST_IOS::in | BOOST_IOS::out )
- { open(detail::path(path), mode); }
+ {
+ init();
+ open(detail::path(path), mode);
+ }
 
     // Copy constructor
     file_descriptor(const file_descriptor& other);
@@ -113,6 +116,7 @@
     std::time_t last_write_time() const;
     void set_last_write_time(std::time_t) const;
 private:
+ void init();
 
     // open overload taking a detail::path
     void open( const detail::path& path,

Modified: trunk/libs/iostreams/src/file_descriptor.cpp
==============================================================================
--- trunk/libs/iostreams/src/file_descriptor.cpp (original)
+++ trunk/libs/iostreams/src/file_descriptor.cpp 2008-06-25 14:20:31 EDT (Wed, 25 Jun 2008)
@@ -369,6 +369,8 @@
 
 bool file_descriptor::is_open() const { return pimpl_->is_open(); }
 
+void file_descriptor::close() { pimpl_->close(); }
+
 std::streamsize file_descriptor::read(char_type* s, std::streamsize n)
 { return pimpl_->read(s, n); }
 
@@ -378,8 +380,6 @@
 std::streampos file_descriptor::seek(stream_offset off, BOOST_IOS::seekdir way)
 { return pimpl_->seek(off, way); }
 
-void file_descriptor::close() { pimpl_->close(); }
-
 detail::file_handle file_descriptor::handle() const { return pimpl_->handle_; }
 
 std::time_t file_descriptor::last_read_time() const
@@ -394,6 +394,8 @@
 void file_descriptor::set_last_write_time(std::time_t tm) const
 { pimpl_->set_last_write_time(tm); }
 
+void file_descriptor::init() { pimpl_.reset(new impl_type); }
+
 void file_descriptor::open(
     const detail::path& path,
     BOOST_IOS::openmode mode,


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