]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/parameter/test/literate/predicate-requirements0.cpp
2 #include <boost/parameter.hpp>
3 #include <boost/graph/adjacency_list.hpp>
4 #include <boost/graph/depth_first_search.hpp>
6 BOOST_PARAMETER_NAME((_graph
, graphs
) graph
)
7 BOOST_PARAMETER_NAME((_visitor
, graphs
) visitor
)
8 BOOST_PARAMETER_NAME((_root_vertex
, graphs
) root_vertex
)
9 BOOST_PARAMETER_NAME((_index_map
, graphs
) index_map
)
10 BOOST_PARAMETER_NAME((_color_map
, graphs
) color_map
)
13 // We first need to define a few metafunction that we use in the
17 struct traversal_category
19 typedef typename
boost::graph_traits
<G
>::traversal_category type
;
23 struct vertex_descriptor
25 typedef typename
boost::graph_traits
<G
>::vertex_descriptor type
;
31 typedef typename
boost::property_traits
<G
>::value_type type
;
37 typedef typename
boost::property_traits
<G
>::key_type type
;
40 template<class Size
, class IndexMap
>
41 boost::iterator_property_map
<
42 boost::default_color_type
*, IndexMap
43 , boost::default_color_type
, boost::default_color_type
&
45 default_color_map(Size num_vertices
, IndexMap
const& index_map
)
47 std::vector
<boost::default_color_type
> colors(num_vertices
);
51 BOOST_PARAMETER_FUNCTION(
52 (void), depth_first_search
, graphs
57 boost::is_convertible
<
58 traversal_category
<_
>, boost::incidence_graph_tag
60 , boost::is_convertible
<
61 traversal_category
<_
>, boost::vertex_list_graph_tag
66 (visitor
, *, boost::dfs_visitor
<>()) // not checkable
69 , (vertex_descriptor
<graphs::graph::_
>)
70 , *vertices(graph
).first
)
74 boost::is_integral
<value_type
<_
> >
76 vertex_descriptor
<graphs::graph::_
>, key_type
<_
>
79 , get(boost::vertex_index
,graph
))
83 vertex_descriptor
<graphs::graph::_
>, key_type
<_
>
85 , default_color_map(num_vertices(graph
), index_map
) )
92 typedef boost::adjacency_list
<boost::vecS
, boost::vecS
, boost::directedS
> G
;
94 enum {u
, v
, w
, x
, y
, z
, N
};
95 typedef std::pair
<int, int> E
;
96 E edges
[] = {E(u
, v
), E(u
, x
), E(x
, v
), E(y
, x
), E(v
, y
), E(w
, y
),
98 G
g(edges
, edges
+ sizeof(edges
) / sizeof(E
), N
);
100 ::depth_first_search(g
);
101 ::depth_first_search(g
, _root_vertex
= (int)x
);