Boost logo

Boost Users :

Subject: [Boost-users] [BGL] Accessing internal properties and returning a "template"-type
From: Cedric Laczny (cedric.laczny_at_[hidden])
Date: 2010-11-16 13:58:26


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 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