|
Boost Users : |
Subject: [Boost-users] [BGL] predecessor map from a view on a multi_array
From: Geoff Hilton (geoff.hilton_at_[hidden])
Date: 2010-02-01 20:48:01
Hi, I'm currently using MSVC9 and the code listed below doesn't compile,
instead producing the following errors and warnings:
Warning 1 warning C4100: 'x' : unreferenced formal parameter
c:\program files\boost\boost_1_41_0\boost\concept\detail\msvc.hpp 20 test
Warning 2 warning C4100: 'id' : unreferenced formal parameter
c:\program
files\boost\boost_1_41_0\boost\graph\dag_shortest_paths.hpp 86 test
Error 3 error C2440: '<function-style-cast>' : cannot convert from
'int' to 'D' c:\program files\microsoft visual studio
9.0\vc\include\limits 109 test
I know MSVC has issues with named parameters among other things, but I
haven't been able to get it to compile with the non-named-parameters
overload either, in this instance.
What am I misusing and how am I misusing it? Also, I get the impression
that the default combiner/comparer may be unsafe for floating-point
comparisons and addition (with respect to over/underflow and comparing
floating point values, I seem to recall it being a good idea never to
compare with direct equalities, eg. x == infinity because of rounding
issues). Might it be a good idea to further specialize appropriate areas
of the algorithm code to account for this, or am I
over-generalizing(specializing?)? How about a specialized closed_plus<>
in relax.hpp which makes the comparisons more safely for floats and
doubles (since both parameters "a" and "b" of closed_plus must be of
type T anyway)?
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dag_shortest_paths.hpp>
#include <boost/multi_array.hpp>
namespace geoff {
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS
,boost::no_property, float> Graph;
typedef
boost::multi_array<boost::graph_traits<Graph>::vertex_descriptor, 2U>
PredecessorsMatrix;
typedef PredecessorsMatrix::array_view<1>::type PredecessorMap;
} //namespace geoff
int main(int /*argc*/, char* /*argv*/[])
{
const std::size_t num_agents = 3;
geoff::Graph graph;
geoff::PredecessorsMatrix
per_agent_matrix(boost::extents[num_agents][boost::num_vertices(graph)]);
geoff::PredecessorsMatrix::index_gen indices;
std::size_t agent_index = 0U;
geoff::PredecessorMap agent_x_predecessors =
per_agent_matrix[indices[agent_index][boost::multi_array_types::index_range()]];
boost::dag_shortest_paths(graph, 0,
boost::predecessor_map(agent_x_predecessors));
}
Thanks very much,
Geoff
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