Boost logo

Boost Users :

From: Shufei Fan (fansf_at_[hidden])
Date: 2007-03-01 11:06:41


I defined an double array inside bundled vertex property, and have trouble
finding ways of accessing it.
Neither can I find any where in the document an example on it. Your input will
be much appreciated!
 
my graph is defined as follows:
 
struct Node
{
  double mode[3];
  // this is hard to access
};

struct Edge
{
  double nPixels;
  unsigned short nTh;
  //no problem access them
};

typedef boost::adjacency_list<
    boost::vecS, boost::vecS, boost::bidirectionalS,
    Node, Edge> Graph;
 
Graph colGraph;

I have no problem with accessing the 'nPixels' in Edge property,
 
  boost::property_map<Graph, double Edge::*>::type
   ew = get(&Edge::nPixels, *colGraph);//edge weight

But I am in a great deal of trouble finding ways of accessing 'mode' in Node
property.
  compiler error here:
  boost::property_map<Graph, double Node::*>::type
   nm = get(&Node::mode, *colGraph);//node mode
error message is :
//----------------------------------------------------
c:\...\xxx.cpp(236) : error C2440: 'initializing' : cannot convert
from 'boost::property_map<Graph,Property>::type'
to 'boost::bundle_property_map<Graph,Descriptor,Bundle,T>'
        with
        [
            
Graph=boost::adjacency_list<boost::vecS,boost::vecS,boost::bidirectionalS,Node,
Edge>,
            Property=double (Node::* )[3]
        ]
        and
        [
            Graph=Graph,
            Descriptor=boost::property_map<Graph,double Node::* >::descriptor,
            Bundle=Node,
            T=double
        ]
        No constructor could take the source type, or constructor overload
resolution was ambiguous
//----------------------------------------------------
 
neither the following works(I added '[3]' in the parameter list):
  boost::property_map<Graph, double Node::*[3]>::type
   nm = get(&Node::mode, *colGraph);//node mode
 
This time errors are raised in the 'property.hpp' file, they are:
//----------------------------------------------------
c:\Boost\include\boost-1_33_1\boost\pending\property.hpp(40) : error
C2825: 'PropertyTag::kind': cannot form a qualified name
        c:\Boost\include\boost-1_33_1\boost\graph\properties.hpp(198) : see
reference to class template instantiation 'boost::property_kind<PropertyTag>'
being compiled
        with
        [
            PropertyTag=double Node::* [3]
        ]
        c:\shufei\VCProjects\edison\segm\GA.cpp(236) : see reference to class
template instantiation 'boost::property_map<Graph,Property>' being compiled
        with
        [
            Graph=Graph,
            Property=double Node::* [3]
        ]
c:\Boost\include\boost-1_33_1\boost\pending\property.hpp(40) : error
C2039: 'kind' : is not a member of 'operator``global namespace'''
c:\Boost\include\boost-1_33_1\boost\pending\property.hpp(40) : error C2146:
syntax error : missing ';' before identifier 'type'
c:\Boost\include\boost-1_33_1\boost\pending\property.hpp(40) : error
C2955: 'boost::type' : use of class template requires template argument list
        c:\Boost\include\boost-1_33_1\boost\type.hpp(14) : see declaration
of 'boost::type'
c:\Boost\include\boost-1_33_1\boost\pending\property.hpp(40) : fatal error
C1903: unable to recover from previous error(s); stopping compilation
//----------------------------------------------------

thanks,
Shufei
 


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