Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4427: for_each does not take a non-const Function object
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-11-04 11:13:10
#4427: for_each does not take a non-const Function object
---------------------------+----------------------
Reporter: chetant@⦠| Owner: djowel
Type: Bugs | Status: reopened
Milestone: Boost 1.44.0 | Component: fusion
Version: Boost 1.43.0 | Severity: Problem
Resolution: | Keywords: for_each
---------------------------+----------------------
Comment (by anonymous):
Replying to [comment:6 djowel]:
> F can be passed around by value and any changes there will not update
the actual F you passed in.
F can be wrapped in std::ref and any changes there will update the actual
F.
> Even STL algorithms are designed that way, so I am not sure why you are
surprised (e.g. http://en.cppreference.com/w/cpp/algorithm/for_each;
notice UnaryFunction f)
Notice, that f is passed by value, but not const reference.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4427#comment:8> 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:14 UTC