Merged more changes (bug fixes, especially hopefully fixing the VC++ test failure) from trunk

[SVN r79390]
This commit is contained in:
Jeremiah Willcock 2012-07-09 20:07:47 +00:00
parent 708d8b62a5
commit 6604e3a013
3 changed files with 100 additions and 15 deletions

View File

@ -139,7 +139,7 @@ public:
euclidean_heuristic(vertex_descriptor goal):m_goal(goal) {};
double operator()(vertex_descriptor v) {
return sqrt(pow(m_goal[0] - v[0], 2) + pow(m_goal[1] - v[1], 2));
return sqrt(pow(double(m_goal[0] - v[0]), 2) + pow(double(m_goal[1] - v[1]), 2));
}
private:

View File

@ -95,6 +95,12 @@ namespace boost {
typedef edge_weight_map type;
typedef edge_weight_map const_type;
};
template<>
struct property_map< const ring_graph, edge_weight_t > {
typedef edge_weight_map type;
typedef edge_weight_map const_type;
};
}
// Tag values that specify the traversal type in graph::traversal_category.
@ -374,7 +380,7 @@ edges_size_type num_edges(const ring_graph& g) {
// AdjacencyMatrix valid expressions
std::pair<edge_descriptor, bool>
edge(vertex_descriptor u, vertex_descriptor v, const ring_graph& g) {
if (abs(u-v) == 1 &&
if ((u == v + 1 || v == u + 1) &&
u >= 0 && u < num_vertices(g) && v >= 0 && v < num_vertices(g))
return std::pair<edge_descriptor, bool>(edge_descriptor(u, v), true);
else

View File

@ -43,6 +43,7 @@
#include <boost/functional/hash.hpp>
#include <boost/next_prior.hpp>
#include <boost/property_map/transform_value_property_map.hpp>
#include <boost/mpl/print.hpp>
namespace boost {
@ -1284,22 +1285,51 @@ get_property(const BOOST_CSR_GRAPH_TYPE& g, Tag tag)
return get_property_value(g.m_property, tag);
}
template <typename G, typename Tag, typename Kind>
struct csr_property_map_helper {};
// Kind == void for invalid property tags, so we can use that to SFINAE out
template <BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename Tag>
struct property_map<BOOST_CSR_GRAPH_TYPE, Tag> {
typedef typename detail::property_kind_from_graph<BOOST_CSR_GRAPH_TYPE, Tag>::type kind;
typedef typename boost::mpl::if_<
boost::is_same<kind, vertex_property_tag>,
vertex_all_t,
typename boost::mpl::if_<
boost::is_same<kind, edge_property_tag>,
edge_all_t,
graph_all_t>::type>::type all_tag;
typedef typename property_traits<typename property_map<BOOST_CSR_GRAPH_TYPE, all_tag>::type>::key_type key_type;
typedef typename property_traits<typename property_map<BOOST_CSR_GRAPH_TYPE, all_tag>::type>::value_type plist_type;
typedef transform_value_property_map<detail::lookup_one_property_f<plist_type, Tag>, typename property_map<BOOST_CSR_GRAPH_TYPE, all_tag>::type> type;
typedef transform_value_property_map<detail::lookup_one_property_f<const plist_type, Tag>, typename property_map<BOOST_CSR_GRAPH_TYPE, all_tag>::const_type> const_type;
struct csr_property_map_helper<BOOST_CSR_GRAPH_TYPE, Tag, vertex_property_tag> {
typedef vertex_all_t all_tag;
typedef typename property_traits<typename property_map<BOOST_CSR_GRAPH_TYPE, vertex_all_t>::type>::key_type key_type;
typedef VertexProperty plist_type;
typedef typename property_map<BOOST_CSR_GRAPH_TYPE, vertex_all_t>::type all_type;
typedef typename property_map<BOOST_CSR_GRAPH_TYPE, vertex_all_t>::const_type all_const_type;
typedef transform_value_property_map<detail::lookup_one_property_f<plist_type, Tag>, all_type> type;
typedef transform_value_property_map<detail::lookup_one_property_f<const plist_type, Tag>, all_const_type> const_type;
};
template <BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename Tag>
struct csr_property_map_helper<BOOST_CSR_GRAPH_TYPE, Tag, edge_property_tag> {
typedef edge_all_t all_tag;
typedef typename property_traits<typename property_map<BOOST_CSR_GRAPH_TYPE, edge_all_t>::type>::key_type key_type;
typedef EdgeProperty plist_type;
typedef typename property_map<BOOST_CSR_GRAPH_TYPE, edge_all_t>::type all_type;
typedef typename property_map<BOOST_CSR_GRAPH_TYPE, edge_all_t>::const_type all_const_type;
typedef transform_value_property_map<detail::lookup_one_property_f<plist_type, Tag>, all_type> type;
typedef transform_value_property_map<detail::lookup_one_property_f<const plist_type, Tag>, all_const_type> const_type;
};
template <BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename Tag>
struct csr_property_map_helper<BOOST_CSR_GRAPH_TYPE, Tag, graph_property_tag> {
typedef graph_all_t all_tag;
typedef BOOST_CSR_GRAPH_TYPE* key_type;
typedef GraphProperty plist_type;
typedef typename property_map<BOOST_CSR_GRAPH_TYPE, graph_all_t>::type all_type;
typedef typename property_map<BOOST_CSR_GRAPH_TYPE, graph_all_t>::const_type all_const_type;
typedef transform_value_property_map<detail::lookup_one_property_f<plist_type, Tag>, all_type> type;
typedef transform_value_property_map<detail::lookup_one_property_f<const plist_type, Tag>, all_const_type> const_type;
};
template <BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename Tag>
struct property_map<BOOST_CSR_GRAPH_TYPE, Tag>:
csr_property_map_helper<
BOOST_CSR_GRAPH_TYPE,
Tag,
typename detail::property_kind_from_graph<BOOST_CSR_GRAPH_TYPE, Tag>
::type> {};
template <BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename Tag>
typename property_map<BOOST_CSR_GRAPH_TYPE, Tag>::type
get(Tag tag, BOOST_CSR_GRAPH_TYPE& g) {
@ -1367,6 +1397,13 @@ struct property_map<BOOST_CSR_GRAPH_TYPE, edge_all_t>
typedef typename BOOST_CSR_GRAPH_TYPE::forward_type::inherited_edge_properties::const_edge_map_type const_type;
};
template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
struct property_map<BOOST_CSR_GRAPH_TYPE, graph_all_t>
{
typedef boost::ref_property_map<BOOST_CSR_GRAPH_TYPE*, typename BOOST_CSR_GRAPH_TYPE::graph_property_type> type;
typedef boost::ref_property_map<BOOST_CSR_GRAPH_TYPE*, const typename BOOST_CSR_GRAPH_TYPE::graph_property_type> const_type;
};
template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
inline typed_identity_property_map<Vertex>
get(vertex_index_t, const BOOST_CSR_GRAPH_TYPE&)
@ -1513,6 +1550,48 @@ put(edge_all_t,
put(get(edge_all, g), e, val);
}
template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
inline typename property_map<BOOST_CSR_GRAPH_TYPE, graph_all_t>::type
get(graph_all_t, BOOST_CSR_GRAPH_TYPE& g)
{
return typename property_map<BOOST_CSR_GRAPH_TYPE, graph_all_t>::type(g.m_property);
}
template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
inline typename property_map<BOOST_CSR_GRAPH_TYPE, graph_all_t>::const_type
get(graph_all_t, const BOOST_CSR_GRAPH_TYPE& g)
{
return typename property_map<BOOST_CSR_GRAPH_TYPE, graph_all_t>::const_type(g.m_property);
}
template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
inline GraphProperty&
get(graph_all_t,
BOOST_CSR_GRAPH_TYPE& g,
BOOST_CSR_GRAPH_TYPE*)
{
return g.m_property;
}
template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
inline const GraphProperty&
get(graph_all_t,
const BOOST_CSR_GRAPH_TYPE& g,
BOOST_CSR_GRAPH_TYPE*)
{
return g.m_property;
}
template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
inline void
put(graph_all_t,
BOOST_CSR_GRAPH_TYPE& g,
BOOST_CSR_GRAPH_TYPE*,
const GraphProperty& val)
{
g.m_property = val;
}
#undef BOOST_CSR_GRAPH_TYPE
#undef BOOST_CSR_GRAPH_TEMPLATE_PARMS
#undef BOOST_DIR_CSR_GRAPH_TYPE