2
0
mirror of https://github.com/boostorg/graph.git synced 2026-02-02 08:52:10 +00:00

fixed some function lookup problems due to VC++ no Koenig

[SVN r7810]
This commit is contained in:
Jeremy Siek
2000-09-25 04:05:40 +00:00
parent 38de833b80
commit 7fa4ba5abc
3 changed files with 58 additions and 19 deletions

View File

@@ -41,6 +41,9 @@
// REVISION HISTORY:
//
// $Log$
// Revision 1.15 2000/09/25 04:05:40 jsiek
// fixed some function lookup problems due to VC++ no Koenig
//
// Revision 1.14 2000/09/24 22:59:22 david_abrahams
// untabify so I can read it!
//
@@ -1103,18 +1106,21 @@ namespace boost {
typename boost::property_map<typename Config::graph_type,
Property>::const_type
>::value_type
get(Property p, const adj_list_helper<Config, Base>& g, const Key& key) {
typedef typename Property::kind Kind;
get(Property p, const adj_list_helper<Config, Base>& g_,
const Key& key) {
typedef typename Config::graph_type Graph;
const Graph& g = static_cast<const Graph&>(g_);
return get(get(p, g), key);
}
template <class Config, class Base, class Property, class Key, class Value>
template <class Config, class Base, class Property, class Key,class Value>
inline void
put(Property p, adj_list_helper<Config, Base>& g,
const Key& key, const Value& value)
{
typedef typename Config::graph_type Graph;
typedef typename boost::property_map<Graph, Property>::type Map;
Map pmap = get(p, g);
Map pmap = get(p, static_cast<Graph&>(g));
put(pmap, key, value);
}
@@ -1635,6 +1641,7 @@ namespace boost {
};
} // namespace detail
//=========================================================================
// Vertex Property Maps
@@ -1700,9 +1707,9 @@ namespace boost {
struct vec_adj_list_any_vertex_pa {
template <class Tag, class Graph, class Plugin>
struct bind {
typedef detail::vec_adj_list_vertex_property_map
typedef vec_adj_list_vertex_property_map
<Graph, Graph&, Plugin, Tag> type;
typedef detail::vec_adj_list_vertex_property_map
typedef vec_adj_list_vertex_property_map
<Graph, const Graph&, Plugin, Tag> const_type;
};
};
@@ -1714,6 +1721,7 @@ namespace boost {
typedef vec_adj_list_vertex_id_map<Plugin, Vertex> const_type;
};
};
namespace detail {
template <class Tag>
struct vec_adj_list_choose_vertex_pa_helper {
typedef vec_adj_list_any_vertex_pa type;
@@ -1730,17 +1738,13 @@ namespace boost {
typedef typename Bind::type type;
typedef typename Bind::const_type const_type;
};
} // namespace detail
//=========================================================================
// Edge Property Map
template <class Directed, class Plugin, class Vertex, class Tag>
struct adj_list_edge_property_map
: public boost::put_get_at_helper<
typename plugin_value<Plugin,Tag>::type,
adj_list_edge_property_map<Directed,Plugin,Vertex,Tag>
>
{
typedef typename plugin_value<Plugin,Tag>::type value_type;
typedef detail::bidir_edge<Directed, Vertex> key_type;
@@ -1754,16 +1758,34 @@ namespace boost {
return get_plugin_value(*p, value_type(), Tag());
}
};
// Very strange VC++ bug appears when I use put_get_at helper
// so I explicitly write out get and put. Also, didn't just
// call operator[] because that also causes the problem!
template <class D, class P, class Vertex, class Tag, class K>
inline typename adj_list_edge_property_map<D,P,Vertex,Tag>::value_type
get(const adj_list_edge_property_map<D,P,Vertex,Tag>& pmap, const K& e)
{
typedef typename plugin_value<P,Tag>::type value_type;
const P* p = (P*)e.get_plugin();
return get_plugin_value(*p, value_type(), Tag());
}
template <class D, class P, class Vertex, class Tag, class K, class V>
inline void
put(adj_list_edge_property_map<D,P,Vertex,Tag>& pmap, const K& k,
const V& val)
{
typedef typename plugin_value<P,Tag>::type value_type;
const P* p = (P*)e.get_plugin();
get_plugin_value(*p, value_type(), Tag()) = val;
}
} // namespace detail
// Edge Property Maps
struct adj_list_edge_property_selector {
template <class Graph, class Plugin, class Tag>
struct bind {
typedef detail::adj_list_edge_property_map
typedef adj_list_edge_property_map
<typename Graph::directed_category, Plugin,
typename Graph::vertex_descriptor,Tag> type;
typedef type const_type;
@@ -1783,7 +1805,7 @@ namespace boost {
struct adj_list_vertex_property_selector {
template <class Graph, class Plugin, class Tag>
struct bind {
typedef detail::adj_list_vertex_property_map<Graph,Plugin,Tag> type;
typedef adj_list_vertex_property_map<Graph,Plugin,Tag> type;
typedef type const_type;
};
};
@@ -1805,7 +1827,6 @@ namespace boost {
typedef vec_adj_list_vertex_property_selector type;
};
} // namespace boost
#ifdef BOOST_NO_ITERATOR_ADAPTORS

View File

@@ -57,7 +57,7 @@ public:
struct children_type {
struct iterator
: std::iterator<std::bidirectional_iterator_tag, array_binary_tree_node,
: boost::iterator<std::bidirectional_iterator_tag, array_binary_tree_node,
difference_type, array_binary_tree_node*, array_binary_tree_node&>
{ // replace with iterator_adaptor implementation -JGS

View File

@@ -63,7 +63,8 @@ class reverse_graph {
};
template <class BidirectionalGraph>
inline reverse_graph<BidirectionalGraph> make_reverse_graph(BidirectionalGraph& g)
inline reverse_graph<BidirectionalGraph>
make_reverse_graph(BidirectionalGraph& g)
{
return reverse_graph<BidirectionalGraph>(g);
}
@@ -82,6 +83,23 @@ get(Property p, const reverse_graph<BidirectionalGraph>& g)
return get(p, g.m_g);
}
template <class BidirectionalGraph, class Property, class Key>
typename property_traits<
typename property_map<BidirectionalGraph, Property>::const_type
>::value_type
get(Property p, const reverse_graph<BidirectionalGraph>& g, const Key& k)
{
return get(p, g.m_g, k);
}
template <class BidirectionalGraph, class Property, class Key, class Value>
void
put(Property p, const reverse_graph<BidirectionalGraph>& g, const Key& k,
const Value& val)
{
put(p, g.m_g, k, val);
}
template <class BidirectionalGraph>
std::pair<typename BidirectionalGraph::vertex_iterator, typename BidirectionalGraph::vertex_iterator>
vertices(const reverse_graph<BidirectionalGraph>& g)
@@ -148,6 +166,6 @@ in_degree(const typename BidirectionalGraph::vertex_descriptor u,
return out_degree(u, g.m_g);
}
}
} // namespace boost
#endif