|
Boost : |
Subject: Re: [boost] [iterator] counting_iterator and reverse iterator problem (was: [graph][iterators] csr graph and reverse iterator problem)
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-09-07 15:55:26
On Wed, 7 Sep 2011, Takatoshi Kondo wrote:
> Hi, All
>
> I'm using Boost.Graph and Boost.Iterators.
>
> When I use the compressed_sparse_row_graph with reverse_iterator,
> I ran into a problem.
>
> When I dereference the reverse_iterator of
> compressed_sparse_row_graph's iterator, invalid memory access occurs.
I tried my copy of GCC 4.6, and get a similar problem. It does not seem
to related to Boost.Graph at all, though; I get the same result (use of
uninitialized value) with counting_iterators that are created directly
(CSR graph vertex_iterators are counting_iterators). I changed the
subject line to emphasize the Boost.Iterator issue. Here is a
trimmed-down program that has similar problems, even with optimization
disabled:
#include <boost/iterator/reverse_iterator.hpp>
#include <boost/iterator/counting_iterator.hpp>
#include <iostream>
int main() {
boost::counting_iterator<int> ie(2);
boost::reverse_iterator<boost::counting_iterator<int> > rib(ie);
std::cout << *rib << std::endl;
return 0;
}
-- Jeremiah Willcock
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk