
On 26/01/2011 18:51, Michel MORIN wrote:
Dave Abrahams wrote:
I see two alternatives: - either the fact that transform_iterator uses boost::result_of is removed from the release branch - or the release branch is fixed so that the feature is not buggy.
Either one of those is OK with me.
After digging into the transform_iterator's result_of problem further, I'm beginning to doubt the correctness of the documentation.
I think that boost::result_of<UnaryFunction(Iterator::reference)> (which is described in the documentation) is incorrect, and the correct one is boost::result_of<const UnaryFunction(Iterator::reference)>.
This is because 1. The dereference operator of transform_iterator is a const member function. 2. So, in the dereference operator, UnaryFunction is treated as a const object.
After actually looking at the issue, I can confirm that is correct. Good thing you spotted that (especially important for the decltype-based implementation of result_of).
Hmm, what should we do?
I think the right thing to do is probably to make it use boost::result_of<const UnaryFunction(typename std::iterator_traits<Iterator>::reference)> on the trunk, fix the doc, check the tests still pass on all expected targets, then merge it to release unless the release manager disagrees. I for one have been waiting for this feature for a long time, so I'd be glad to have it (and have it working!) in a release as soon as possible.