Boost logo

Boost Users :

Subject: [Boost-users] Property maps hierarchy compilation errors
From: ostroganov (oleg.stroganov_at_[hidden])
Date: 2010-04-05 03:12:30


Hi,

I want to create hierarchy of property maps like this:

#include <boost/graph/adjacency_list.hpp>
#include <boost/property_map/property_map.hpp>
using namespace boost;

struct Base_NodeP {
  int basic_property;
};
struct NodeP : public Base_NodeP {
  // using Base_NodeP::basic_property
  int derived_property;
};
int main(){
  typedef adjacency_list<setS, vecS, undirectedS,
property<vertex_index_t,int,NodeP>, no_property> TGraph;
  property_map<TGraph, int NodeP::*>::type _basic_property;
  property_map<TGraph, int NodeP::*>::type _derived_property;

  TGraph tgraph;
  _derived_property = get(&NodeP::derived_property, tgraph);
  _basic_property = get(&NodeP::basic_property, tgraph);

  return 0;
}

When I compile this code in MSVS 2008, I'm getting

error C2679: binary '=' : no operator found which takes a right-hand operand
of type 'boost::bundle_property_map<Graph,Descriptor,Bundle,T>' (or there is
no acceptable conversion).

gcc 4.3.2 gives similar error:

error: no match for ‘operator=’ in ‘_basic_property = boost::get [with
OutEdgeListS = boost::setS, VertexListS = boost::vecS, DirectedS =
boost::undirectedS, VertexProperty = boost::property<boost::vertex_index_t,
int, NodeP>, EdgeProperty = boost::no_property, GraphProperty =
boost::no_property, EdgeListS = boost::listS, T = int, Bundle =
Base_NodeP](&Base_NodeP::basic_property,
((boost::adjacency_list<boost::setS, boost::vecS, boost::undirectedS,
boost::property<boost::vertex_index_t, int, NodeP>, boost::no_property,
boost::no_property, boost::listS>&)(& tgraph)))

When I uncomment "using Base_NodeP::basic_property" in NodeP declaration,
MSVS is happy, but gcc
still cannot compile the code.

Do you have any suggestions, how can I make this code work under gcc? Am I
doing something wrong?

Thanks for any help,

Oleg

-- 
View this message in context: http://old.nabble.com/Property-maps-hierarchy-compilation-errors-tp28137714p28137714.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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