Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-07-14 17:31:20


Matthias Troyer <troyer_at_[hidden]> writes:

> On Monday, July 14, 2003, at 11:04 PM, David Abrahams wrote:
>
>> Matthias Troyer <troyer_at_[hidden]> writes:
>>
>>> I now get the following compile-time error on MacOS X using g++
>>> v. 3.1:
>>>
>>> /Users/troyer/src/boost/boost/iterator/iterator_adaptor.hpp:282:
>>> sizeof'
>>> applied to incomplete type
>>> boost::STATIC_ASSERTION_FAILURE<false>'
>>>
>>> Can anybody help?
>>
>> What were you compiling? Reproducible case, please!
>
> Sorry, Here is an example that shows the problem in a simple case:
>
> #include <boost/graph/adjacency_list.hpp>
> #include <iostream>
>
> int main()
> {
> boost::adjacency_list<boost::vecS,boost::vecS,boost::undirectedS,
> boost::no_property, boost::no_property, boost::no_property,
> boost::vecS> g;
> std::cout << boost::source(*(boost::edges(g).first+4),g) << std::endl;
> return 0;
> }
>
> The problem is adding an integer to an edge iterator of this graph. Is
> this a problem of the iterator adaptor library or of the BGL?

It's a BGL problem, specifically in the way it used to label its
iterators and the way I translated them. These iterators were always
given the "multi_pass_input_iterator" tag, because they didn't
dereference lvalues yet copies could be guaranteed to traverse the
same elements. The old iterator adaptors were more permissive in
allowing you to take advantage of operations which weren't accounted
for by the iterator category, when defined (because we didn't have a
good way of expressing the iterator's real category anyway), and I
guess the BGL took advantage of that. I believe that the BGL's
iterators should really have a traversal category equal to that of
the iterators they're adapting. It's sort-of too bad we don't have a
way to express that.

Hmm, we could say that when you pass a tag which is just a traversal
category tag or just an access category tag as iterator_adaptor's
Category parameter, it takes the other part of the category from the
Base iterator.

Thoughts?

Who's going to fix up the graph library?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk