[Boost-bugs] [Boost C++ Libraries] #8081: suggestion: avoid using postfix operator++ in transform_width

Subject: [Boost-bugs] [Boost C++ Libraries] #8081: suggestion: avoid using postfix operator++ in transform_width
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-02-16 22:08:03


#8081: suggestion: avoid using postfix operator++ in transform_width
------------------------------+---------------------------------------------
 Reporter: jinmei@… | Owner: ramey
     Type: Patches | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost 1.53.0 | Severity: Optimization
 Keywords: |
------------------------------+---------------------------------------------
 Starting Boost 1.53.0,
 boost::archive::iterators::transform_width::fill()
 is using the postfix form of operator++ on the base iterator:
 {{{#!cpp
                 m_buffer_in = * this->base_reference()++;
 }}}

 I couldn't find information about the rationale except the actual
 commit and its log message:
 http://lists.boost.org/boost-commit/2012/12/43985.php
 but I guess it's related to "base64 read un initialized memory".
 In any case, the use of the postfix version is suboptimal in terms of
 efficiency, so I'd like to propose the attached patch. As far as
 I can see it doesn't change the behavior and can run more efficiently.
 (Also, as a bonus, it eliminates the only place of this class
 requesting the postfix version, so it will work with a "lazy"
 implementation of the base iterator that skips to implement that
 version of operator++).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8081>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC