Regarding property maps
Hi all, I have been working on a graph using boost graph library with edge properties as bundled properties.I have the following struct as my edge property, typedef struct Edge{ int id; int source; int target; float cost; float reverse_cost; } Edge; Provided that I am inserting the data correctly,how do I get a property map for each of the elements of the struct,that is a property map for id,a property map for the source and so on.And moreover I also want to know how to extract the type of property map,as it is required to pass its type to other function as a template parameter. Thanks in advance.
Rohith Reddy wrote: I have been working on a graph using boost graph library with edge properties as bundled properties.I have the following struct as my edge property,
typedef struct Edge{ int id; int source; int target; float cost; float reverse_cost; } Edge;
Provided that I am inserting the data correctly,how do I get a property map for each of the elements of the struct,that is a property map for id,a property map for the source and so on.And moreover I also want to know how to extract the type of property map,as it is required to pass its type to other function as a template parameter.
Thanks in advance.
I had the same problem and developed a member_property_map to access the member of a bundled map.
It allows the following:
typedef boost::vector_property_map<edge> bundle_map_type;
typedef blink::member_property_map
Hey alex,
Thanks a lot for the reply.That worked for me.But can you help me
understand the following in your code,
1.Second argument of the constructor,
member_property_map(Map map, Type bundle_type::* member)
: m_map(map), m_member(member)
{}
2.What does the put_get_helper class actually do?
Thanks in advance.
On Tue, Sep 22, 2015 at 5:44 PM, alex
Rohith Reddy wrote: I have been working on a graph using boost graph library with edge properties as bundled properties.I have the following struct as my edge property,
typedef struct Edge{ int id; int source; int target; float cost; float reverse_cost; } Edge;
Provided that I am inserting the data correctly,how do I get a property map for each of the elements of the struct,that is a property map for id,a property map for the source and so on.And moreover I also want to know how to extract the type of property map,as it is required to pass its type to other function as a template parameter.
Thanks in advance.
I had the same problem and developed a member_property_map to access the member of a bundled map.
It allows the following:
typedef boost::vector_property_map<edge> bundle_map_type; typedef blink::member_property_map
cost_map_type; bundle_map_type bundle_map; cost_map_type cost_map(bundle_map, &edge::cost);
See attached for the implementation and example.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks a lot for the reply.
You're welcome.
That worked for me. But can you help me understand the following in your code,
1.Second argument of the constructor, member_property_map(Map map, Type bundle_type::* member) : m_map(map), m_member(member) {}
It is a pointer-to-data-member and it's the only time I have ever used it. http://en.cppreference.com/w/cpp/language/pointer#Pointers_to_data_members
2.What does the put_get_helper class actually do?
The property map concepts require the following usage: value = get(map, key) and put(map, key, value). put_get_helper is a an undocumented (and empty) class in property_map.hpp. By deriving from put_get_helper a class that implements operator[] will match the get and put functions defined in property_map.hpp. http://www.boost.org/doc/libs/1_59_0/boost/property_map/property_map.hpp
participants (2)
-
alex
-
Rohith Reddy