Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9668: insert_check and callees should pass KeyValueCompare by const reference
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-15 10:15:57
#9668: insert_check and callees should pass KeyValueCompare by const reference
-------------------------------+--------------------------
Reporter: vinnie.falco@⦠| Owner: igaztanaga
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: intrusive
Version: Boost 1.55.0 | Severity: Optimization
Resolution: invalid | Keywords:
-------------------------------+--------------------------
Changes (by igaztanaga):
* status: new => closed
* resolution: => invalid
Comment:
Thanks for the report. You can always wrap your function objects with a
type that holds a reference to your heavyweight function object. Passing
by const-reference forces operator() to be const which is not required
right now (and thus, this is backwards incompatible). For other function
objects used in Intrusive, like cloners and disposers, non-const
operator() is very useful to recycle nodes.
Usually function in the C++ standard algorithms predicates are passed as
values for very good reasons:
http://stackoverflow.com/questions/8196345/passing-functor-object-by-
value-vs-by-reference-c
I think you can always obtain the desired performance with a little
wrapper. Passing by value is the intended behavior in Intrusive. Maybe not
optimal in some cases, but this is by design.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9668#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:15 UTC