mirror of
https://github.com/boostorg/graph.git
synced 2026-02-27 05:02:22 +00:00
Merged Boost.Graph changes from trunk
[SVN r80740]
This commit is contained in:
@@ -370,8 +370,8 @@ namespace boost {
|
||||
detail::make_property_map_from_arg_pack_gen<tag::rank_map, D>(D())(g, arg_pack),
|
||||
detail::make_property_map_from_arg_pack_gen<tag::distance_map, D>(D())(g, arg_pack),
|
||||
detail::override_const_property(arg_pack, _weight_map, g, edge_weight),
|
||||
detail::override_const_property(arg_pack, _vertex_index_map, g, vertex_index),
|
||||
detail::make_color_map_from_arg_pack(g, arg_pack),
|
||||
detail::override_const_property(arg_pack, _vertex_index_map, g, vertex_index),
|
||||
arg_pack[_distance_compare | std::less<D>()],
|
||||
arg_pack[_distance_combine | closed_plus<D>(inf)],
|
||||
inf,
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace detail {
|
||||
typedef boost::iterator_facade<default_construct_iterator<T>, T, std::random_access_iterator_tag, const T&> base_type;
|
||||
T saved_value;
|
||||
const T& dereference() const {return saved_value;}
|
||||
bool equal(default_construct_iterator i) const {return true;}
|
||||
bool equal(default_construct_iterator /*i*/) const {return true;}
|
||||
void increment() {}
|
||||
void decrement() {}
|
||||
void advance(typename base_type::difference_type) {}
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
#ifndef BOOST_GRAPH_CORE_NUMBERS_HPP
|
||||
#define BOOST_GRAPH_CORE_NUMBERS_HPP
|
||||
|
||||
#include <boost/pending/mutable_queue.hpp>
|
||||
#include <boost/pending/indirect_cmp.hpp>
|
||||
#include <boost/graph/detail/d_ary_heap.hpp>
|
||||
#include <boost/graph/breadth_first_search.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
@@ -159,7 +158,8 @@ namespace boost {
|
||||
if (get(c,u) > v_cn) {
|
||||
// remove the edge
|
||||
put(c,u,get(c,u)-get(wm,*oi));
|
||||
Q.update(u);
|
||||
if (Q.contains(u))
|
||||
Q.update(u);
|
||||
}
|
||||
}
|
||||
vis.finish_vertex(v,g);
|
||||
@@ -175,13 +175,14 @@ namespace boost {
|
||||
{
|
||||
typedef typename property_traits<CoreMap>::value_type D;
|
||||
typedef std::less<D> Cmp;
|
||||
typedef indirect_cmp<CoreMap,Cmp > IndirectCmp;
|
||||
IndirectCmp icmp(c, Cmp());
|
||||
// build the mutable queue
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor vertex;
|
||||
typedef mutable_queue<vertex, std::vector<vertex>, IndirectCmp,
|
||||
IndexMap> MutableQueue;
|
||||
MutableQueue Q(num_vertices(g), icmp, im);
|
||||
std::vector<std::size_t> index_in_heap_data(num_vertices(g));
|
||||
typedef iterator_property_map<std::vector<std::size_t>::iterator, IndexMap>
|
||||
index_in_heap_map_type;
|
||||
index_in_heap_map_type index_in_heap_map(index_in_heap_data.begin(), im);
|
||||
typedef d_ary_heap_indirect<vertex, 4, index_in_heap_map_type, CoreMap, Cmp> MutableQueue;
|
||||
MutableQueue Q(c, index_in_heap_map, Cmp());
|
||||
typename graph_traits<Graph>::vertex_iterator vi,vi_end;
|
||||
for (boost::tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) {
|
||||
Q.push(*vi);
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
#include <boost/shared_array.hpp>
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
|
||||
// WARNING: it is not safe to copy a d_ary_heap_indirect and then modify one of
|
||||
// the copies. The class is required to be copyable so it can be passed around
|
||||
// (without move support from C++11), but it deep-copies the heap contents yet
|
||||
// shallow-copies the index_in_heap_map.
|
||||
|
||||
namespace boost {
|
||||
|
||||
// Swap two elements in a property map without assuming they model
|
||||
|
||||
@@ -253,7 +253,7 @@ class indexed_edge_properties<Derived, void, Descriptor, IndexMap>
|
||||
typedef secret const_edge_map_type;
|
||||
|
||||
secret operator[](secret) { return secret(); }
|
||||
void write_by_index(std::size_t idx, const no_property& prop) {}
|
||||
void write_by_index(std::size_t /*idx*/, const no_property& /*prop*/) {}
|
||||
|
||||
edge_map_type get_edge_bundle(const IndexMap& = IndexMap()) const {
|
||||
return edge_map_type();
|
||||
@@ -270,7 +270,7 @@ class indexed_edge_properties<Derived, void, Descriptor, IndexMap>
|
||||
|
||||
public:
|
||||
void push_back(const edge_push_back_type&) { }
|
||||
void move_range(std::size_t src_begin, std::size_t src_end, std::size_t dest_begin) {}
|
||||
void move_range(std::size_t /*src_begin*/, std::size_t /*src_end*/, std::size_t /*dest_begin*/) {}
|
||||
|
||||
typedef dummy_no_property_iterator iterator;
|
||||
iterator begin() {return dummy_no_property_iterator();}
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace boost {
|
||||
// Shit, can't implement this without knowing the size of the
|
||||
// universe.
|
||||
template <class K, class C, class A>
|
||||
void set_compliment(const std::set<K,C,A>& x,
|
||||
void set_compliment(const std::set<K,C,A>& /*x*/,
|
||||
std::set<K,C,A>& z)
|
||||
{
|
||||
z.clear();
|
||||
|
||||
@@ -195,7 +195,6 @@ namespace boost {
|
||||
|
||||
typedef filtered_graph_tag graph_tag;
|
||||
|
||||
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
// Bundled properties support
|
||||
template<typename Descriptor>
|
||||
typename graph::detail::bundled_result<Graph, Descriptor>::type&
|
||||
@@ -206,11 +205,10 @@ namespace boost {
|
||||
typename graph::detail::bundled_result<Graph, Descriptor>::type const&
|
||||
operator[](Descriptor x) const
|
||||
{ return this->m_g[x]; }
|
||||
#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
|
||||
static vertex_descriptor null_vertex()
|
||||
{
|
||||
return Graph::null_vertex();
|
||||
return Traits::null_vertex();
|
||||
}
|
||||
|
||||
//private:
|
||||
@@ -222,26 +220,21 @@ namespace boost {
|
||||
template <typename Graph,
|
||||
typename EdgePredicate,
|
||||
typename VertexPredicate>
|
||||
struct vertex_property_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> > {
|
||||
typedef typename vertex_property_type<Graph>::type type;
|
||||
};
|
||||
struct vertex_property_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> >:
|
||||
vertex_property_type<Graph> {};
|
||||
|
||||
template <typename Graph,
|
||||
typename EdgePredicate,
|
||||
typename VertexPredicate>
|
||||
struct edge_property_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> > {
|
||||
typedef typename edge_property_type<Graph>::type type;
|
||||
};
|
||||
struct edge_property_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> >:
|
||||
edge_property_type<Graph> {};
|
||||
|
||||
template <typename Graph,
|
||||
typename EdgePredicate,
|
||||
typename VertexPredicate>
|
||||
struct graph_property_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> > {
|
||||
typedef typename graph_property_type<Graph>::type type;
|
||||
};
|
||||
struct graph_property_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> >:
|
||||
graph_property_type<Graph> {};
|
||||
|
||||
|
||||
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
template<typename Graph, typename EdgePredicate, typename VertexPredicate>
|
||||
struct vertex_bundle_type<filtered_graph<Graph, EdgePredicate,
|
||||
VertexPredicate> >
|
||||
@@ -256,7 +249,6 @@ namespace boost {
|
||||
struct graph_bundle_type<filtered_graph<Graph, EdgePredicate,
|
||||
VertexPredicate> >
|
||||
: graph_bundle_type<Graph> { };
|
||||
#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
|
||||
//===========================================================================
|
||||
// Non-member functions for the Filtered Edge Graph
|
||||
|
||||
@@ -30,11 +30,6 @@
|
||||
#define BOOST_GRID_GRAPH_TYPE \
|
||||
grid_graph<DimensionsT, VertexIndexT, EdgeIndexT>
|
||||
|
||||
#define BOOST_GRID_GRAPH_TYPE_MEM typename BOOST_GRID_GRAPH_TYPE::
|
||||
|
||||
#define BOOST_GRID_GRAPH_TYPE_TD(mem) \
|
||||
typedef typename BOOST_GRID_GRAPH_TYPE::mem mem
|
||||
|
||||
#define BOOST_GRID_GRAPH_TRAITS_T \
|
||||
typename graph_traits<BOOST_GRID_GRAPH_TYPE >
|
||||
|
||||
@@ -68,6 +63,13 @@ namespace boost {
|
||||
return (m_graph->index_of(key));
|
||||
}
|
||||
|
||||
friend inline Index
|
||||
get(const grid_graph_index_map<Graph, Descriptor, Index>& index_map,
|
||||
const typename grid_graph_index_map<Graph, Descriptor, Index>::key_type& key)
|
||||
{
|
||||
return (index_map[key]);
|
||||
}
|
||||
|
||||
protected:
|
||||
const Graph* m_graph;
|
||||
};
|
||||
@@ -106,6 +108,13 @@ namespace boost {
|
||||
value_type operator[](const key_type& key) const {
|
||||
return (value_type(key.second, key.first));
|
||||
}
|
||||
|
||||
friend inline Descriptor
|
||||
get(const grid_graph_reverse_edge_map<Descriptor>& rev_map,
|
||||
const typename grid_graph_reverse_edge_map<Descriptor>::key_type& key)
|
||||
{
|
||||
return (rev_map[key]);
|
||||
}
|
||||
};
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
@@ -442,7 +451,7 @@ namespace boost {
|
||||
vertex_descriptor vertex_at
|
||||
(vertices_size_type vertex_index) const {
|
||||
|
||||
array<vertices_size_type, Dimensions> vertex;
|
||||
boost::array<vertices_size_type, Dimensions> vertex;
|
||||
vertices_size_type index_divider = 1;
|
||||
|
||||
for (std::size_t dimension_index = 0;
|
||||
@@ -532,6 +541,8 @@ namespace boost {
|
||||
vertex_descriptor source_vertex = source(edge, *this);
|
||||
vertex_descriptor target_vertex = target(edge, *this);
|
||||
|
||||
BOOST_ASSERT (source_vertex != target_vertex);
|
||||
|
||||
// Determine the dimension where the source and target vertices
|
||||
// differ (should only be one if this is a valid edge).
|
||||
std::size_t different_dimension_index = 0;
|
||||
@@ -732,13 +743,12 @@ namespace boost {
|
||||
// VertexListGraph
|
||||
//================
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline std::pair<BOOST_GRID_GRAPH_TYPE_MEM vertex_iterator,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM vertex_iterator>
|
||||
vertices(const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
BOOST_GRID_GRAPH_TYPE_TD(vertex_iterator);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(vertex_function);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(vertex_index_iterator);
|
||||
friend inline std::pair<typename type::vertex_iterator,
|
||||
typename type::vertex_iterator>
|
||||
vertices(const type& graph) {
|
||||
typedef typename type::vertex_iterator vertex_iterator;
|
||||
typedef typename type::vertex_function vertex_function;
|
||||
typedef typename type::vertex_index_iterator vertex_index_iterator;
|
||||
|
||||
return (std::make_pair
|
||||
(vertex_iterator(vertex_index_iterator(0),
|
||||
@@ -747,16 +757,14 @@ namespace boost {
|
||||
vertex_function(&graph))));
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type
|
||||
num_vertices(const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
friend inline typename type::vertices_size_type
|
||||
num_vertices(const type& graph) {
|
||||
return (graph.num_vertices());
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor
|
||||
vertex(BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type vertex_index,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
friend inline typename type::vertex_descriptor
|
||||
vertex(typename type::vertices_size_type vertex_index,
|
||||
const type& graph) {
|
||||
|
||||
return (graph.vertex_at(vertex_index));
|
||||
}
|
||||
@@ -765,14 +773,13 @@ namespace boost {
|
||||
// IncidenceGraph
|
||||
//===============
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline std::pair<BOOST_GRID_GRAPH_TYPE_MEM out_edge_iterator,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM out_edge_iterator>
|
||||
out_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
BOOST_GRID_GRAPH_TYPE_TD(degree_iterator);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(out_edge_function);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(out_edge_iterator);
|
||||
friend inline std::pair<typename type::out_edge_iterator,
|
||||
typename type::out_edge_iterator>
|
||||
out_edges(typename type::vertex_descriptor vertex,
|
||||
const type& graph) {
|
||||
typedef typename type::degree_iterator degree_iterator;
|
||||
typedef typename type::out_edge_function out_edge_function;
|
||||
typedef typename type::out_edge_iterator out_edge_iterator;
|
||||
|
||||
return (std::make_pair
|
||||
(out_edge_iterator(degree_iterator(0),
|
||||
@@ -781,19 +788,17 @@ namespace boost {
|
||||
out_edge_function(vertex, &graph))));
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type
|
||||
friend inline typename type::degree_size_type
|
||||
out_degree
|
||||
(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
(typename type::vertex_descriptor vertex,
|
||||
const type& graph) {
|
||||
return (graph.out_degree(vertex));
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor
|
||||
out_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM degree_size_type out_edge_index,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
friend inline typename type::edge_descriptor
|
||||
out_edge_at(typename type::vertex_descriptor vertex,
|
||||
typename type::degree_size_type out_edge_index,
|
||||
const type& graph) {
|
||||
return (graph.out_edge_at(vertex, out_edge_index));
|
||||
}
|
||||
|
||||
@@ -801,14 +806,13 @@ namespace boost {
|
||||
// AdjacencyGraph
|
||||
//===============
|
||||
|
||||
template <BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend typename std::pair<BOOST_GRID_GRAPH_TYPE_MEM adjacency_iterator,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM adjacency_iterator>
|
||||
adjacent_vertices (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
BOOST_GRID_GRAPH_TYPE_TD(degree_iterator);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(adjacent_vertex_function);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(adjacency_iterator);
|
||||
friend typename std::pair<typename type::adjacency_iterator,
|
||||
typename type::adjacency_iterator>
|
||||
adjacent_vertices (typename type::vertex_descriptor vertex,
|
||||
const type& graph) {
|
||||
typedef typename type::degree_iterator degree_iterator;
|
||||
typedef typename type::adjacent_vertex_function adjacent_vertex_function;
|
||||
typedef typename type::adjacency_iterator adjacency_iterator;
|
||||
|
||||
return (std::make_pair
|
||||
(adjacency_iterator(degree_iterator(0),
|
||||
@@ -821,26 +825,23 @@ namespace boost {
|
||||
// EdgeListGraph
|
||||
//==============
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type
|
||||
num_edges(const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
friend inline typename type::edges_size_type
|
||||
num_edges(const type& graph) {
|
||||
return (graph.num_edges());
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor
|
||||
edge_at(BOOST_GRID_GRAPH_TYPE_MEM edges_size_type edge_index,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
friend inline typename type::edge_descriptor
|
||||
edge_at(typename type::edges_size_type edge_index,
|
||||
const type& graph) {
|
||||
return (graph.edge_at(edge_index));
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline std::pair<BOOST_GRID_GRAPH_TYPE_MEM edge_iterator,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM edge_iterator>
|
||||
edges(const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
BOOST_GRID_GRAPH_TYPE_TD(edge_index_iterator);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(edge_function);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(edge_iterator);
|
||||
friend inline std::pair<typename type::edge_iterator,
|
||||
typename type::edge_iterator>
|
||||
edges(const type& graph) {
|
||||
typedef typename type::edge_index_iterator edge_index_iterator;
|
||||
typedef typename type::edge_function edge_function;
|
||||
typedef typename type::edge_iterator edge_iterator;
|
||||
|
||||
return (std::make_pair
|
||||
(edge_iterator(edge_index_iterator(0),
|
||||
@@ -853,14 +854,13 @@ namespace boost {
|
||||
// BiDirectionalGraph
|
||||
//===================
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline std::pair<BOOST_GRID_GRAPH_TYPE_MEM in_edge_iterator,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM in_edge_iterator>
|
||||
in_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
BOOST_GRID_GRAPH_TYPE_TD(in_edge_function);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(degree_iterator);
|
||||
BOOST_GRID_GRAPH_TYPE_TD(in_edge_iterator);
|
||||
friend inline std::pair<typename type::in_edge_iterator,
|
||||
typename type::in_edge_iterator>
|
||||
in_edges(typename type::vertex_descriptor vertex,
|
||||
const type& graph) {
|
||||
typedef typename type::in_edge_function in_edge_function;
|
||||
typedef typename type::degree_iterator degree_iterator;
|
||||
typedef typename type::in_edge_iterator in_edge_iterator;
|
||||
|
||||
return (std::make_pair
|
||||
(in_edge_iterator(degree_iterator(0),
|
||||
@@ -869,25 +869,22 @@ namespace boost {
|
||||
in_edge_function(vertex, &graph))));
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type
|
||||
in_degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
friend inline typename type::degree_size_type
|
||||
in_degree (typename type::vertex_descriptor vertex,
|
||||
const type& graph) {
|
||||
return (graph.in_degree(vertex));
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type
|
||||
degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
friend inline typename type::degree_size_type
|
||||
degree (typename type::vertex_descriptor vertex,
|
||||
const type& graph) {
|
||||
return (graph.out_degree(vertex) * 2);
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor
|
||||
in_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM degree_size_type in_edge_index,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
friend inline typename type::edge_descriptor
|
||||
in_edge_at(typename type::vertex_descriptor vertex,
|
||||
typename type::degree_size_type in_edge_index,
|
||||
const type& graph) {
|
||||
return (graph.in_edge_at(vertex, in_edge_index));
|
||||
}
|
||||
|
||||
@@ -896,21 +893,20 @@ namespace boost {
|
||||
// Adjacency Matrix
|
||||
//==================
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend std::pair<BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, bool>
|
||||
edge (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor source_vertex,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor destination_vertex,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
friend std::pair<typename type::edge_descriptor, bool>
|
||||
edge (typename type::vertex_descriptor source_vertex,
|
||||
typename type::vertex_descriptor destination_vertex,
|
||||
const type& graph) {
|
||||
|
||||
std::pair<BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, bool> edge_exists =
|
||||
std::pair<typename type::edge_descriptor, bool> edge_exists =
|
||||
std::make_pair(std::make_pair(source_vertex, destination_vertex), false);
|
||||
|
||||
for (std::size_t dimension_index = 0;
|
||||
dimension_index < Dimensions;
|
||||
++dimension_index) {
|
||||
|
||||
BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type dim_difference = 0;
|
||||
BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type
|
||||
typename type::vertices_size_type dim_difference = 0;
|
||||
typename type::vertices_size_type
|
||||
source_dim = source_vertex[dimension_index],
|
||||
dest_dim = destination_vertex[dimension_index];
|
||||
|
||||
@@ -957,77 +953,54 @@ namespace boost {
|
||||
// Index Property Map Functions
|
||||
//=============================
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type
|
||||
friend inline typename type::vertices_size_type
|
||||
get(vertex_index_t,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex) {
|
||||
const type& graph,
|
||||
typename type::vertex_descriptor vertex) {
|
||||
return (graph.index_of(vertex));
|
||||
}
|
||||
|
||||
template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type
|
||||
friend inline typename type::edges_size_type
|
||||
get(edge_index_t,
|
||||
const BOOST_GRID_GRAPH_TYPE& graph,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor edge) {
|
||||
const type& graph,
|
||||
typename type::edge_descriptor edge) {
|
||||
return (graph.index_of(edge));
|
||||
}
|
||||
|
||||
template <BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline grid_graph_index_map<
|
||||
BOOST_GRID_GRAPH_TYPE,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type>
|
||||
get(vertex_index_t, const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
type,
|
||||
typename type::vertex_descriptor,
|
||||
typename type::vertices_size_type>
|
||||
get(vertex_index_t, const type& graph) {
|
||||
return (grid_graph_index_map<
|
||||
BOOST_GRID_GRAPH_TYPE,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type>(graph));
|
||||
type,
|
||||
typename type::vertex_descriptor,
|
||||
typename type::vertices_size_type>(graph));
|
||||
}
|
||||
|
||||
template <BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline grid_graph_index_map<
|
||||
BOOST_GRID_GRAPH_TYPE,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM edges_size_type>
|
||||
get(edge_index_t, const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
type,
|
||||
typename type::edge_descriptor,
|
||||
typename type::edges_size_type>
|
||||
get(edge_index_t, const type& graph) {
|
||||
return (grid_graph_index_map<
|
||||
BOOST_GRID_GRAPH_TYPE,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor,
|
||||
BOOST_GRID_GRAPH_TYPE_MEM edges_size_type>(graph));
|
||||
type,
|
||||
typename type::edge_descriptor,
|
||||
typename type::edges_size_type>(graph));
|
||||
}
|
||||
|
||||
template <BOOST_GRID_GRAPH_TEMPLATE_PARAMS>
|
||||
friend inline grid_graph_reverse_edge_map<
|
||||
BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor>
|
||||
get(edge_reverse_t, const BOOST_GRID_GRAPH_TYPE& graph) {
|
||||
typename type::edge_descriptor>
|
||||
get(edge_reverse_t, const type& graph) {
|
||||
return (grid_graph_reverse_edge_map<
|
||||
BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor>());
|
||||
typename type::edge_descriptor>());
|
||||
}
|
||||
|
||||
template<typename Graph,
|
||||
typename Descriptor,
|
||||
typename Index>
|
||||
friend inline Index
|
||||
get(const grid_graph_index_map<Graph, Descriptor, Index>& index_map,
|
||||
const typename grid_graph_index_map<Graph, Descriptor, Index>::key_type& key)
|
||||
{
|
||||
return (index_map[key]);
|
||||
}
|
||||
|
||||
template<typename Graph,
|
||||
typename Descriptor,
|
||||
typename Index>
|
||||
friend struct grid_graph_index_map;
|
||||
|
||||
template<typename Descriptor>
|
||||
friend inline Descriptor
|
||||
get(const grid_graph_reverse_edge_map<Descriptor>& rev_map,
|
||||
const typename grid_graph_reverse_edge_map<Descriptor>::key_type& key)
|
||||
{
|
||||
return (rev_map[key]);
|
||||
}
|
||||
|
||||
template<typename Descriptor>
|
||||
friend struct grid_graph_reverse_edge_map;
|
||||
|
||||
@@ -1036,8 +1009,6 @@ namespace boost {
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_GRID_GRAPH_TYPE
|
||||
#undef BOOST_GRID_GRAPH_TYPE_TD
|
||||
#undef BOOST_GRID_GRAPH_TYPE_MEM
|
||||
#undef BOOST_GRID_GRAPH_TEMPLATE_PARAMS
|
||||
#undef BOOST_GRID_GRAPH_TRAITS_T
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace graph_detail {
|
||||
{
|
||||
// If the element is already occupied, then we probably don't want to
|
||||
// overwrite it.
|
||||
if(c[l] == Graph::null_vertex()) return false;
|
||||
if(c[l] == graph_traits<Graph>::null_vertex()) return false;
|
||||
c[l] = v;
|
||||
return true;
|
||||
}
|
||||
@@ -411,7 +411,7 @@ public:
|
||||
|
||||
/** Return a null descriptor */
|
||||
static vertex_descriptor null_vertex()
|
||||
{ return graph_type::null_vertex(); }
|
||||
{ return graph_traits<graph_type>::null_vertex(); }
|
||||
|
||||
private:
|
||||
graph_type _graph;
|
||||
@@ -525,7 +525,7 @@ public:
|
||||
#endif
|
||||
|
||||
static vertex_descriptor null_vertex()
|
||||
{ return graph_type::null_vertex(); }
|
||||
{ return graph_traits<graph_type>::null_vertex(); }
|
||||
|
||||
private:
|
||||
graph_type* _graph;
|
||||
|
||||
@@ -432,13 +432,13 @@ BOOST_BGL_DECLARE_NAMED_PARAMS
|
||||
template <typename ArgType, typename Prop, typename Graph, bool Exists>
|
||||
struct override_property_t {
|
||||
typedef ArgType result_type;
|
||||
result_type operator()(const Graph& g, const typename boost::add_reference<ArgType>::type a) const {return a;}
|
||||
result_type operator()(const Graph&, const typename boost::add_reference<ArgType>::type a) const {return a;}
|
||||
};
|
||||
|
||||
template <typename ArgType, typename Prop, typename Graph>
|
||||
struct override_property_t<ArgType, Prop, Graph, false> {
|
||||
typedef typename boost::property_map<Graph, Prop>::type result_type;
|
||||
result_type operator()(const Graph& g, const ArgType& a) const {return get(Prop(), g);}
|
||||
result_type operator()(const Graph& g, const ArgType&) const {return get(Prop(), g);}
|
||||
};
|
||||
|
||||
template <typename ArgPack, typename Tag, typename Prop, typename Graph>
|
||||
@@ -455,7 +455,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS
|
||||
|
||||
template <typename ArgPack, typename Tag, typename Prop, typename Graph>
|
||||
typename override_property_result<ArgPack, Tag, Prop, Graph>::type
|
||||
override_property(const ArgPack& ap, const boost::parameter::keyword<Tag>& t, const Graph& g, Prop prop) {
|
||||
override_property(const ArgPack& ap, const boost::parameter::keyword<Tag>& t, const Graph& g, Prop) {
|
||||
return override_property_t<
|
||||
typename boost::parameter::value_type<ArgPack, Tag, int>::type,
|
||||
Prop,
|
||||
@@ -633,7 +633,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS
|
||||
typedef Q priority_queue_type;
|
||||
|
||||
static priority_queue_type
|
||||
make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q& q) {
|
||||
make_queue(const Graph&, const ArgPack&, KeyT, const Q& q) {
|
||||
return q;
|
||||
}
|
||||
};
|
||||
@@ -645,7 +645,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS
|
||||
typedef boost::d_ary_heap_indirect<ValueT, 4, index_in_heap_map, typename map_maker<Graph, ArgPack, KeyMapTag, KeyT>::helper::map_type, Compare> priority_queue_type;
|
||||
|
||||
static priority_queue_type
|
||||
make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q& q) {
|
||||
make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q&) {
|
||||
return priority_queue_type(
|
||||
map_maker<Graph, ArgPack, KeyMapTag, KeyT>::make_map(g, ap, defaultKey),
|
||||
map_maker<Graph, ArgPack, IndexInHeapMapTag, default_index_in_heap_type>::make_map(g, ap, typename boost::property_traits<index_in_heap_map>::value_type(-1))
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
typedef vertex_name_type argument_type;
|
||||
typedef VertexProperty result_type;
|
||||
|
||||
VertexProperty operator()(const vertex_name_type& name)
|
||||
VertexProperty operator()(const vertex_name_type&)
|
||||
{
|
||||
boost::throw_exception(std::runtime_error("add_vertex: "
|
||||
"unable to create a vertex from its name"));
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <boost/graph/property_maps/null_property_map.hpp>
|
||||
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
@@ -149,13 +149,13 @@ namespace boost {
|
||||
template <typename G, typename R, typename T>
|
||||
struct property_kind_from_graph<G, R T::*> {
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_same<T, typename vertex_bundle_type<G>::type>,
|
||||
boost::is_base_of<T, typename vertex_bundle_type<G>::type>,
|
||||
vertex_property_tag,
|
||||
typename boost::mpl::if_<
|
||||
boost::is_same<T, typename edge_bundle_type<G>::type>,
|
||||
boost::is_base_of<T, typename edge_bundle_type<G>::type>,
|
||||
edge_property_tag,
|
||||
typename boost::mpl::if_<
|
||||
boost::is_same<T, typename graph_bundle_type<G>::type>,
|
||||
boost::is_base_of<T, typename graph_bundle_type<G>::type>,
|
||||
graph_property_tag,
|
||||
void>::type>::type>::type type;
|
||||
};
|
||||
|
||||
@@ -49,20 +49,30 @@ namespace boost {
|
||||
Vertex u = source(e, g), v = target(e, g);
|
||||
typedef typename property_traits<DistanceMap>::value_type D;
|
||||
typedef typename property_traits<WeightMap>::value_type W;
|
||||
D d_u = get(d, u), d_v = get(d, v);
|
||||
W w_e = get(w, e);
|
||||
const D d_u = get(d, u);
|
||||
const D d_v = get(d, v);
|
||||
const W& w_e = get(w, e);
|
||||
|
||||
// The redundant gets in the return statements are to ensure that extra
|
||||
// floating-point precision in x87 registers does not lead to relax()
|
||||
// returning true when the distance did not actually change.
|
||||
// The seemingly redundant comparisons after the distance puts are to
|
||||
// ensure that extra floating-point precision in x87 registers does not
|
||||
// lead to relax() returning true when the distance did not actually
|
||||
// change.
|
||||
if ( compare(combine(d_u, w_e), d_v) ) {
|
||||
put(d, v, combine(d_u, w_e));
|
||||
put(p, v, u);
|
||||
return compare(get(d, v), d_v);
|
||||
if (compare(get(d, v), d_v)) {
|
||||
put(p, v, u);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (is_undirected && compare(combine(d_v, w_e), d_u)) {
|
||||
put(d, u, combine(d_v, w_e));
|
||||
put(p, u, v);
|
||||
return compare(get(d, u), d_u);
|
||||
if (compare(get(d, u), d_u)) {
|
||||
put(p, u, v);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ template <class G>
|
||||
typename enable_if<is_reverse_graph<G>,
|
||||
detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor> >::type
|
||||
get(edge_underlying_t,
|
||||
G& g)
|
||||
G&)
|
||||
{
|
||||
return detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor>();
|
||||
}
|
||||
@@ -468,7 +468,7 @@ get(edge_underlying_t,
|
||||
template <class G>
|
||||
typename enable_if<is_reverse_graph<G>, typename graph_traits<typename G::base_type>::edge_descriptor>::type
|
||||
get(edge_underlying_t,
|
||||
G& g,
|
||||
G&,
|
||||
const typename graph_traits<G>::edge_descriptor& k)
|
||||
{
|
||||
return k.underlying_descx;
|
||||
@@ -477,7 +477,7 @@ get(edge_underlying_t,
|
||||
template <class G>
|
||||
typename enable_if<is_reverse_graph<G>, detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor> >::type
|
||||
get(edge_underlying_t,
|
||||
const G& g)
|
||||
const G&)
|
||||
{
|
||||
return detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor>();
|
||||
}
|
||||
@@ -485,7 +485,7 @@ get(edge_underlying_t,
|
||||
template <class G>
|
||||
typename enable_if<is_reverse_graph<G>, typename graph_traits<typename G::base_type>::edge_descriptor>::type
|
||||
get(edge_underlying_t,
|
||||
const G& g,
|
||||
const G&,
|
||||
const typename graph_traits<G>::edge_descriptor& k)
|
||||
{
|
||||
return k.underlying_descx;
|
||||
|
||||
@@ -10,11 +10,6 @@
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
|
||||
// NOTE: The retag_property_list is used to "normalize" a proeprty such that
|
||||
// any non-property conforming parameter is wrapped in a vertex_bundle
|
||||
// property. For example (with bad syntax) retag<property<X>> -> property<X>,
|
||||
// but retag<foo> -> property<vertex_bundle_t, foo>.
|
||||
|
||||
namespace boost
|
||||
{
|
||||
struct undirected_graph_tag { };
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace boost {
|
||||
{}
|
||||
|
||||
template <typename VertexOrEdge, typename Graph>
|
||||
void operator() (VertexOrEdge v, const Graph& g)
|
||||
void operator() (VertexOrEdge v, const Graph&)
|
||||
{
|
||||
put (property_map_, v, value_);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ namespace boost {
|
||||
inline property_put <PropertyMap, EventTag>
|
||||
put_property (PropertyMap property_map,
|
||||
typename property_traits <PropertyMap>::value_type value,
|
||||
EventTag tag)
|
||||
EventTag)
|
||||
{
|
||||
return property_put <PropertyMap, EventTag> (property_map, value);
|
||||
}
|
||||
|
||||
@@ -33,14 +33,15 @@ namespace boost {
|
||||
typedef typename boost::property_traits<ReadablePropertyMap>::key_type K;
|
||||
typedef K first_argument_type;
|
||||
typedef K second_argument_type;
|
||||
typedef T result_type;
|
||||
typedef bool result_type;
|
||||
inline indirect_cmp(const ReadablePropertyMap& df, const Compare& c = Compare())
|
||||
: d(df), cmp(c) { }
|
||||
|
||||
template <class A, class B>
|
||||
inline bool
|
||||
operator()(const A& u, const B& v) const {
|
||||
T du = get(d, u), dv = get(d, v);
|
||||
const T& du = get(d, u);
|
||||
const T& dv = get(d, v);
|
||||
return cmp(du, dv);
|
||||
}
|
||||
protected:
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -53,8 +54,8 @@ namespace boost {
|
||||
enum graph_bundle_t {graph_bundle};
|
||||
|
||||
// Code to look up one property in a property list:
|
||||
template <typename PList, typename PropName>
|
||||
struct lookup_one_property_internal {BOOST_STATIC_CONSTANT(bool, found = false);};
|
||||
template <typename PList, typename PropName, typename Enable = void>
|
||||
struct lookup_one_property_internal {BOOST_STATIC_CONSTANT(bool, found = false); typedef void type;};
|
||||
|
||||
// Special-case properties (vertex_all, edge_all, graph_all)
|
||||
#define BGL_ALL_PROP(tag) \
|
||||
@@ -93,8 +94,14 @@ namespace boost {
|
||||
private: \
|
||||
typedef lookup_one_property_internal<Base, BOOST_JOIN(kind, _bundle_t)> base_type; \
|
||||
public: \
|
||||
static typename base_type::type& lookup(property<Tag, T, Base>& p, BOOST_JOIN(kind, _bundle_t)) {return base_type::lookup(p.m_base, BOOST_JOIN(kind, _bundle_t)());} \
|
||||
static const typename base_type::type& lookup(const property<Tag, T, Base>& p, BOOST_JOIN(kind, _bundle_t)) {return base_type::lookup(p.m_base, BOOST_JOIN(kind, _bundle_t)());} \
|
||||
template <typename BundleTag> \
|
||||
static typename lazy_enable_if_c<(base_type::found && (is_same<BundleTag, BOOST_JOIN(kind, _bundle_t)>::value)), \
|
||||
add_reference<typename base_type::type> >::type \
|
||||
lookup(property<Tag, T, Base>& p, BundleTag) {return base_type::lookup(p.m_base, BOOST_JOIN(kind, _bundle_t)());} \
|
||||
template <typename BundleTag> \
|
||||
static typename lazy_enable_if_c<(base_type::found && (is_same<BundleTag, BOOST_JOIN(kind, _bundle_t)>::value)), \
|
||||
add_reference<const typename base_type::type> >::type \
|
||||
lookup(const property<Tag, T, Base>& p, BundleTag) {return base_type::lookup(p.m_base, BOOST_JOIN(kind, _bundle_t)());} \
|
||||
}; \
|
||||
|
||||
BGL_DO_ONE_BUNDLE_TYPE(vertex)
|
||||
@@ -122,12 +129,14 @@ namespace boost {
|
||||
typedef lookup_one_property_internal<Base, PropName> base_type;
|
||||
public:
|
||||
template <typename PL>
|
||||
static typename enable_if<is_same<PL, boost::property<Tag, T, Base> >, typename base_type::type&>::type
|
||||
static typename lazy_enable_if<is_same<PL, boost::property<Tag, T, Base> >,
|
||||
add_reference<typename base_type::type> >::type
|
||||
lookup(PL& prop, const PropName& tag) {
|
||||
return base_type::lookup(prop.m_base, tag);
|
||||
}
|
||||
template <typename PL>
|
||||
static typename enable_if<is_same<PL, boost::property<Tag, T, Base> >, const typename base_type::type&>::type
|
||||
static typename lazy_enable_if<is_same<PL, boost::property<Tag, T, Base> >,
|
||||
add_reference<const typename base_type::type> >::type
|
||||
lookup(const PL& prop, const PropName& tag) {
|
||||
return base_type::lookup(prop.m_base, tag);
|
||||
}
|
||||
@@ -135,12 +144,12 @@ namespace boost {
|
||||
|
||||
// Pointer-to-member access to bundled properties
|
||||
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
template <typename T, typename R>
|
||||
struct lookup_one_property_internal<T, R T::*> {
|
||||
template <typename T, typename TMaybeBase, typename R>
|
||||
struct lookup_one_property_internal<T, R TMaybeBase::*, typename enable_if<is_base_of<TMaybeBase, T> >::type> {
|
||||
BOOST_STATIC_CONSTANT(bool, found = true);
|
||||
typedef R type;
|
||||
static R& lookup(T& x, R T::*ptr) {return x.*ptr;}
|
||||
static const R& lookup(const T& x, R T::*ptr) {return x.*ptr;}
|
||||
static R& lookup(T& x, R TMaybeBase::*ptr) {return x.*ptr;}
|
||||
static const R& lookup(const T& x, R TMaybeBase::*ptr) {return x.*ptr;}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -153,7 +162,8 @@ namespace boost {
|
||||
BOOST_STATIC_CONSTANT(bool, found = (lookup_one_property_internal<T, Tag>::found));
|
||||
typedef const typename lookup_one_property_internal<T, Tag>::type type;
|
||||
template <typename U>
|
||||
static typename enable_if<is_same<T, U>, const typename lookup_one_property_internal<T, Tag>::type&>::type
|
||||
static typename lazy_enable_if<is_same<T, U>,
|
||||
add_reference<const typename lookup_one_property_internal<T, Tag>::type> >::type
|
||||
lookup(const U& p, Tag tag) {
|
||||
return lookup_one_property_internal<T, Tag>::lookup(p, tag);
|
||||
}
|
||||
@@ -199,58 +209,6 @@ namespace boost {
|
||||
: mpl::bool_<is_same<T, no_property>::value>
|
||||
{ };
|
||||
|
||||
/** @internal @name Retag Property List
|
||||
* This metafunction is used internally to normalize a property if it is
|
||||
* actually modeling a property. Specifically this is used in Boost.Graph
|
||||
* to map user-provided classes into bundled properties.
|
||||
*/
|
||||
//@{
|
||||
// One base case of the recursive form (see below). This matches any
|
||||
// retag request that does not include a property<...> or no_property as
|
||||
// the FinalType. This is used for generating bundles in Boost.Graph.
|
||||
template<typename FinalTag, typename FinalType>
|
||||
struct retag_property_list
|
||||
{
|
||||
typedef property<FinalTag, FinalType> type;
|
||||
typedef FinalType retagged;
|
||||
};
|
||||
|
||||
// Recursively retag the nested property list.
|
||||
template<typename FinalTag, typename Tag, typename T, typename Base>
|
||||
struct retag_property_list<FinalTag, property<Tag, T, Base> >
|
||||
{
|
||||
private:
|
||||
typedef retag_property_list<FinalTag, Base> next;
|
||||
|
||||
public:
|
||||
typedef property<Tag, T, typename next::type> type;
|
||||
typedef typename next::retagged retagged;
|
||||
};
|
||||
|
||||
// This base case will correctly deduce the final property type if the
|
||||
// retagged property is given in property form. This should not hide
|
||||
// the base case below.
|
||||
// NOTE: This addresses a problem of layering bundled properties in the BGL
|
||||
// where multiple retaggings will fail to deduce the correct retagged
|
||||
// type.
|
||||
template<typename FinalTag, typename FinalType>
|
||||
struct retag_property_list<FinalTag, property<FinalTag, FinalType> >
|
||||
{
|
||||
public:
|
||||
typedef property<FinalTag, FinalType> type;
|
||||
typedef FinalType retagged;
|
||||
};
|
||||
|
||||
// A final base case of the retag_property_list, this will terminate a
|
||||
// properly structured list.
|
||||
template<typename FinalTag>
|
||||
struct retag_property_list<FinalTag, no_property>
|
||||
{
|
||||
typedef no_property type;
|
||||
typedef no_property retagged;
|
||||
};
|
||||
//@}
|
||||
|
||||
template <typename PList, typename Tag>
|
||||
class lookup_one_property_f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user