Boost logo

Boost Users :

From: Jeffrey Holle (jeff.holle_at_[hidden])
Date: 2004-09-20 12:27:54


I'm using boost 1_31_0 and gcc 3.4.2.

I'm adding an iterator interface to my class that abstracts use of
internal boost graph properties and have had success with one exception
that involves const_iterator.

Here is how this class looks:

   struct VertexData
   {
                typedef boost::graph_property_iter_range
<DataGraphT,vertex_Datum_t>::iterator iterator;
                typedef boost::graph_property_iter_range
<DataGraphT,vertex_Datum_t>::const_iterator const_iterator;
                typedef Vertex_Datum value_type;

     VertexData(DataGraphT& dataGraph);
                iterator begin(void) {return
boost::get_property_iter_range(dataGraph_,vertex_Datum).first;}
// const_iterator begin(void) const {return
boost::get_property_iter_range(dataGraph_,vertex_Datum).first;}
                iterator end(void) {return
boost::get_property_iter_range(dataGraph_,vertex_Datum).second;}
// const_iterator end(void) const {return
boost::get_property_iter_range(dataGraph_,vertex_Datum).second;}

When I uncomment the const begin method, I get the following compilation
error:

dataGraph.h:30: error: conversion from
`boost::detail::lvalue_pmap_iter<boost::counting_iterator<size_t,
boost::use_default, boost::use_default>,
boost::subgraph_global_property_map<DataGraphT*,
boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS,
boost::property<boost::vertex_index_t, int, VertexProperty>,
EdgeProperty, boost::no_property, boost::listS>,
boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
boost::property<boost::vertex_index_t, int, VertexProperty>,
EdgeProperty, boost::no_property, boost::listS>*, Vertex_Datum,
Vertex_Datum&, vertex_Datum_t> > >' to non-scalar type
`boost::detail::lvalue_pmap_iter<boost::counting_iterator<size_t,
boost::use_default, boost::use_default>,
boost::subgraph_global_property_map<const DataGraphT*,
boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS,
boost::property<boost::vertex_index_t, int, VertexProperty>,
EdgeProperty, boost::no_property, boost::listS>, const
boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
boost::property<boost::vertex_index_t, int, VertexProperty>,
EdgeProperty, boost::no_property, boost::listS>*, Vertex_Datum, const
Vertex_Datum&, vertex_Datum_t> > >' requested

Could somebody point out the problem here?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net