[Iterator] Constness of transform_iterator's function call operator

A long-standing request that transform_iterator should use boost::result_of will be resolved in Boost 1.47. This is really nice news, but I have a concern related to this. In the new code, transform_iterator uses result_of<UnaryFunc(typename std::iterator_traits<Iterator>::reference)> to determine the return type of a functor. However, since transform_iterator's function call operator is const, result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)> should be used instead. There is a patch for this fix in #5127: https://svn.boost.org/trac/boost/ticket/5127 Alternatively, to remove this inconsistency, we can strip the constness of transform_iterator's function call operator by either A. Make UnaryFunc member data mutable as suggested in #4969: https://svn.boost.org/trac/boost/ticket/4969 or B. Add non-const overloads to - transform_iterator's dereference - iterator_core_access' dereference - iterator_facade's operator() Patches for A (make_mutable.patch) and B (add_nonconst_overloads.patch) are attached in this mail. Comments? Regards, Michel
participants (1)
-
Michel MORIN