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

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8081: suggestion: avoid using postfix operator++ in transform_width
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-02-25 21:34:12


#8081: suggestion: avoid using postfix operator++ in transform_width
-------------------------------+--------------------------------------------
  Reporter: jinmei@… | Owner: ramey
      Type: Patches | Status: closed
 Milestone: To Be Determined | Component: serialization
   Version: Boost 1.53.0 | Severity: Optimization
Resolution: invalid | Keywords:
-------------------------------+--------------------------------------------

Comment (by anonymous):

 Replying to [comment:1 ramey]:
> "use of the postfix version is suboptimal in terms of efficiency"
>
> Not in this case.
>
> ++i is more efficient that i++
>
> but
> x = i; ++i
>
> is NOT more efficient than x = i++.

 True, but that's not what the proposed patch does. It does:

 x = i.operator*();
 ++i;

 And, if call to operator*() is more lightweight than copying i, it
 should be more efficient than

 x = i.operator*();
 i++;

 which is essentially what the original code does.

 Am I still misunderstanding something?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8081#comment:2>
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