[BGL] Accessing internal properties and returning a "template"-type

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[BGL] Accessing internal properties and returning a "template"-type

Cedric Laczny
Hi,

I have the following concept:
template < class GRAPH, class EDGE_PREDICATE, class VERTEX_PREDICATE >
class FilteredGraph
{
public:
   
    /// Defines an alias type to represent the filtered_graph
    typedef filtered_graph< GRAPH, EDGE_PREDICATE, VERTEX_PREDICATE >
FilteredGraphContainer;


//
// some c'tors, member functions etc.
//
    template< class VERTEXPROPERTIES >
    VERTEXPROPERTIES& properties(const Vertex& v) const
    {
            typename property_map<FilteredGraphContainer,
vertex_properties_t>::const_type param = get(vertex_properties, graph_);
            return (param[v]);
    }

//
// some more stuff
//
};

When I want to use this code to access the properties of a vertex of the
FilteredGraph, the compiler says that it can't find this function.
I searched around and found some notes about returning a template. The most
prevalent is that the compiler simply does not know which type the function
should return and thus can't find a valid signature and complains.

Is there a way to let it find the type via the property_map? Or some other
ideas how to solve this issue?

I experimented with:
    template< class VERTEXPROPERTIES >
    VERTEXPROPERTIES& properties(const Vertex& v) const
    {
            typename property_map<FilteredGraphContainer,
vertex_properties_t>::const_type param = get(vertex_properties, graph_);
            property_traits< typename property_map<FilteredGraphContainer,
vertex_properties_t>::const_type > prop_trait;
            return prop_trait.reference(param[v]);
    }

but with no success.

Except for this, I have no reason to include a template for VERTEXPROPERTIES
generally to the class. So I would really like to keep that concept as it is.

Thank you.

Best,

Cedric

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users