[Boost-bugs] [Boost C++ Libraries] #4427: for_each does not take a non-const Function object

Subject: [Boost-bugs] [Boost C++ Libraries] #4427: for_each does not take a non-const Function object
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-07-12 16:18:45


#4427: for_each does not take a non-const Function object
-------------------------------+--------------------------------------------
 Reporter: chetant@… | Owner: djowel
     Type: Bugs | Status: new
Milestone: Boost 1.44.0 | Component: fusion
  Version: Boost 1.43.0 | Severity: Problem
 Keywords: for_each |
-------------------------------+--------------------------------------------
 I'm trying to create a type of deserializer, templated by fusion types. I
 have a function object that I initialize with an input stream and its
 templatized operator() takes a record out of that stream and assigns it to
 a given input type.

 I was trying to use fusion::foreach for this:


 {{{
 FusionType fvar;
 EntryReader er(stream);
 // This should call er for each entry in fvar
 for_each(fvar, er);

 }}}

 The problem is that for_each only accepts const references to Function
 objects, so EntryReader::operator()(T& out) cannot read from the stream.
 Is it possible to make the Function reference in for_each non-const?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4427>
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:03 UTC