Boost logo

Boost :

Subject: [boost] [iterator] Help needed understanding output_iterator requirements
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2010-03-15 07:13:09

Dear iterator experts,

Jesse Perla recently reported that boost::multi_array fails compilation for many basic tasks on MSVC 2010. I investigated the failures, because I had already investigated other failures on MSVC 2010 reported by Jesse Perla for boost::ublas. While I'm quite familiar with boost::ublas, I'm a complete novice with respect to boost::multi_array and boost::iterator.

I could track the failures to a specific (intentional?) behavior of iterator_facade from Boost.Iterator (more specifically of facade_iterator_category.hpp):

Thomas Klimpel wrote:
> What effectively happens it that the iterator gets the category
> "input_iterator", but std::copy wants to have an "output_iterator". I
> think I understand why the iterator doesn't satisfies the requirement
> of a "forward_iterator", but it's unclear to me why it didn't qualify
> as an "output_iterator". There is an "input_output_iterator_tag" in
> "boost/iterator/detail/facade_iterator_category.hpp", so it would have
> been possible for the iterator to be both "input_iterator" and
> "output_iterator". However, it seems to me that
> "input_output_iterator_tag" is never used in the Boost.Iterator
> library. I would have to read more about "output_iterator" to
> understand whether Boost.Iterator is correct here. With my current
> understanding of "output_iterator", I would say it's a bug in
> "boost/iterator/detail/facade_iterator_category.hpp".
> Perhaps somebody with more knowledge about "output_iterator" and
> Boost.Iterator can explain to me why an iterator using the
> "boost::random_access_traversal_tag" for the "CategoryOrTraversal"
> template parameter of "iterator_facade" will never get the category
> "output_iterator" (or "input_output_iterator_tag").

Of course I could go on and read more about "output_iterator", or find out whether the Boost.Iterator documentation has to say something about this issue, but since I only came to this problem because I wanted to help Jesse Perla on a problem with boost::multi_array, I would much prefer if an "iterator expert" could "take over".


Boost list run by bdawes at, gregod at, cpdaniel at, john at