Boost logo

Boost Users :

Subject: [Boost-users] Problems with property_maps
From: Trevin Murakami (temurakami_at_[hidden])
Date: 2010-02-27 13:45:54


Hello all.

I'm having issues getting property maps to work properly with my
custom adjacency_list. Here's a snippet of the code:

// Definitions
// define some of the properties the graphs will have
// http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/using_adjacency_list.html
struct posx_t { typedef vertex_property_tag kind; };
struct posy_t { typedef vertex_property_tag kind; };

typedef property<posx_t, int> VertexPosX;
// chain to add in posy
typedef property<posy_t, int, VertexPosX> VertexPos;
// chain to add in vertex_index
typedef property<vertex_index_t, int, VertexPos> VertexProperty;

// define our special graph
typedef adjacency_list<listS, listS, undirectedS,
VertexProperty,
property<edge_weight_t, int> > AGraph;

...

template<class T>
void boostToVAGraph(const AGraph & g,
                                        const int num_nodes, const int num_edges,
                                        T ** idata,
                                        T ** odata,
                                        unsigned int ** segment_descriptor,
                                        unsigned int ** cross_pointers,
                                        unsigned int ** head_flags,
                                        T ** reference,
                                        const testrigOptions & testOptions)
{
        typedef AGraph Graph;

        
        // define the manipulator for our special properties
        // http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/using_adjacency_list.html
        // requires property_map.hpp
        // BROKEN!!!!!
        property_map<AGraph, posx_t>::type
                getposx = get(posx_t(), g);
        property_map<AGraph, posy_t>::type
                getposy = get(posy_t(), g);

...

I used another function to generate the AGraph and apply values. And
using property map there seems to work. However, I then pass it to
this function using:

boostToVAGraph(g, num_nodes, num_edges, idata, odata, segment_descriptor,
                cross_pointers, head_flags, reference,
                testOptions);

On compile, I get this error:
1>agraph.cpp
1>c:/Documents and Settings/All Users/Application Data/NVIDIA
Corporation/NVIDIA GPU Computing SDK/C/src/test/agraph.cpp(94) : error
C2440: 'initializing' : cannot convert from
'boost::adj_list_vertex_property_map<Graph,ValueType,Reference,Tag>'
to 'boost::adj_list_vertex_property_map<Graph,ValueType,Reference,Tag>'
1> with
1> [
1> Graph=AGraph,
1> ValueType=int,
1> Reference=const int &,
1> Tag=posx_t
1> ]
1> and
1> [
1> Graph=AGraph,
1> ValueType=int,
1> Reference=int &,
1> Tag=posx_t
1> ]
1> No constructor could take the source type, or constructor
overload resolution was ambiguous

Ideas?

-Trevin "new to Boost" Murakami


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