transform_iterator::reference

Hi, Boost 1.42.0 documentation of transfrom_iterator says: "If Reference is use_default then the reference member of transform_iterator is result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type. Otherwise, reference is Reference." But it is simply implemented as UnaryFunction::result_type; This discrepancy between documentation and implementation plays a role when I want to use transform_iterator with boost::mem_fn to access member variable of structure. mem_fn's operator() is overridden to provide both const and non-const access to member variable. The discrepancy leads to compilation error for non-const access.

Matwey V. Kornilov wrote:
Boost 1.42.0 documentation of transfrom_iterator says: "If Reference is use_default then the reference member of transform_iterator is result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type. Otherwise, reference is Reference." But it is simply implemented as UnaryFunction::result_type;
This is fixed on trunk, but is not merged to release yet. See the following ticket and thread: https://svn.boost.org/trac/boost/ticket/1427 http://thread.gmane.org/gmane.comp.lib.boost.devel/211573 Hope this helps, Michel

Thanks! It is definitely good news. However I have to use workaround nowadays. :) Michel MORIN wrote:
Matwey V. Kornilov wrote:
Boost 1.42.0 documentation of transfrom_iterator says: "If Reference is use_default then the reference member of transform_iterator is result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type. Otherwise, reference is Reference." But it is simply implemented as UnaryFunction::result_type;
This is fixed on trunk, but is not merged to release yet. See the following ticket and thread:
https://svn.boost.org/trac/boost/ticket/1427 http://thread.gmane.org/gmane.comp.lib.boost.devel/211573
Hope this helps, Michel
participants (2)
-
Matwey V. Kornilov
-
Michel MORIN