Subject: [Boost-bugs] [Boost C++ Libraries] #7107: Support property bundles as default parameter in graph algorithms
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-09 16:07:09
#7107: Support property bundles as default parameter in graph algorithms
-------------------------------------------------+--------------------------
Reporter: philipp.moeller@⦠| Owner: jewillco
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: graph
Version: Boost 1.51.0 | Severity: Optimization
Keywords: property bundles |
-------------------------------------------------+--------------------------
Bundled properties don't support default parameters as internal properties
do. Adding a possibility to tag members of a bundle would solve that
issue.
{{{
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <string>
using namespace std;
using namespace boost;
struct City{};
struct Highway { double weight; };
typedef adjacency_list<
listS, vecS, bidirectionalS,
City, Highway>
Map;
typedef adjacency_list <
listS, vecS, directedS,
no_property, property < edge_weight_t, int > >
Map2;
int main()
{
Map m;
Map2 m2;
vector<double> distances(num_vertices(m2));
dijkstra_shortest_paths(
m2, *vertices(m2).first,
distance_map(make_iterator_property_map(distances.begin(),
get(vertex_index,
m2))));
// does not work
// dijkstra_shortest_paths(
// m, *vertices(m).first,
// boost::distance_map(make_iterator_property_map(distances.begin(),
// get(vertex_index,
m))));
return 0;
}
}}}
One solution could be to add an optional tags typedef that contains an
mpl::map between member pointers and property enum types. Alternatively, a
traits class could be specified to map to the right enum type. Maybe
someone can also come up with a nice mechanism to transparently tag a
member.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7107> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC