2
0
mirror of https://github.com/boostorg/graph.git synced 2026-01-31 08:12:14 +00:00

Replaced uses of ct_if and friends (based on pending/ct_if.hpp) with

uses of mpl::if_ and friends.


[SVN r36269]
This commit is contained in:
Ronald Garcia
2006-12-04 23:23:08 +00:00
parent dde01478fe
commit a237fb8cd9
11 changed files with 60 additions and 53 deletions

View File

@@ -36,7 +36,10 @@
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/graph_selectors.hpp>
#include <boost/property_map.hpp>
#include <boost/pending/ct_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/graph/detail/edge.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/detail/workaround.hpp>
@@ -238,12 +241,12 @@ namespace boost {
namespace detail {
template <class Directed> struct is_random_access {
enum { value = false};
typedef false_type type;
typedef mpl::false_ type;
};
template <>
struct is_random_access<vecS> {
enum { value = true };
typedef true_type type;
typedef mpl::true_ type;
};
} // namespace detail
@@ -268,9 +271,9 @@ namespace boost {
typedef typename DirectedS::is_bidir_t is_bidir;
typedef typename DirectedS::is_directed_t is_directed;
typedef typename boost::ct_if_t<is_bidir,
typedef typename mpl::if_<is_bidir,
bidirectional_tag,
typename boost::ct_if_t<is_directed,
typename mpl::if_<is_directed,
directed_tag, undirected_tag
>::type
>::type directed_category;
@@ -279,7 +282,7 @@ namespace boost {
edge_parallel_category;
typedef void* vertex_ptr;
typedef typename boost::ct_if_t<is_rand_access,
typedef typename mpl::if_<is_rand_access,
std::size_t, vertex_ptr>::type vertex_descriptor;
typedef detail::edge_desc_impl<directed_category, vertex_descriptor>
edge_descriptor;
@@ -292,10 +295,10 @@ namespace boost {
typedef typename container_gen<EdgeListS, dummy>::type EdgeContainer;
typedef typename DirectedS::is_bidir_t BidirectionalT;
typedef typename DirectedS::is_directed_t DirectedT;
typedef typename ct_and<DirectedT,
typename ct_not<BidirectionalT>::type >::type on_edge_storage;
typedef typename mpl::and_<DirectedT,
typename mpl::not_<BidirectionalT>::type >::type on_edge_storage;
public:
typedef typename boost::ct_if_t<on_edge_storage,
typedef typename mpl::if_<on_edge_storage,
std::size_t, typename EdgeContainer::size_type
>::type edges_size_type;
@@ -352,10 +355,10 @@ namespace boost {
edge_property_type;
// The types that are actually bundled
typedef typename ct_if<(is_same<maybe_vertex_bundled, no_property>::value),
typedef typename mpl::if_c<(is_same<maybe_vertex_bundled, no_property>::value),
no_vertex_bundle,
maybe_vertex_bundled>::type vertex_bundled;
typedef typename ct_if<(is_same<maybe_edge_bundled, no_property>::value),
typedef typename mpl::if_c<(is_same<maybe_edge_bundled, no_property>::value),
no_edge_bundle,
maybe_edge_bundled>::type edge_bundled;
#else

View File

@@ -19,7 +19,7 @@
#include <boost/iterator.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/graph_selectors.hpp>
#include <boost/pending/ct_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/graph/adjacency_iterator.hpp>
#include <boost/graph/detail/edge.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
@@ -438,7 +438,7 @@ namespace boost {
// in_degree, etc.).
BOOST_STATIC_ASSERT(!(is_same<Directed, bidirectionalS>::value));
typedef typename boost::ct_if_t<is_directed,
typedef typename mpl::if_<is_directed,
bidirectional_tag, undirected_tag>::type
directed_category;
@@ -492,10 +492,10 @@ namespace boost {
public:
// The types that are actually bundled
typedef typename ct_if<(is_same<maybe_vertex_bundled, no_property>::value),
typedef typename mpl::if_c<(is_same<maybe_vertex_bundled, no_property>::value),
no_vertex_bundle,
maybe_vertex_bundled>::type vertex_bundled;
typedef typename ct_if<(is_same<maybe_edge_bundled, no_property>::value),
typedef typename mpl::if_c<(is_same<maybe_edge_bundled, no_property>::value),
no_edge_bundle,
maybe_edge_bundled>::type edge_bundled;
#else
@@ -506,7 +506,7 @@ namespace boost {
#endif
public: // should be private
typedef typename ct_if_t<typename has_property<edge_property_type>::type,
typedef typename mpl::if_<typename has_property<edge_property_type>::type,
std::pair<bool, edge_property_type>, char>::type StoredEdge;
#if (defined(BOOST_MSVC) && BOOST_MSVC <= 1300) || defined(BOOST_NO_STD_ALLOCATOR)
typedef std::vector<StoredEdge> Matrix;
@@ -540,7 +540,7 @@ namespace boost {
vertex_descriptor, MatrixIter, size_type, edge_descriptor
> UnDirOutEdgeIter;
typedef typename ct_if_t<
typedef typename mpl::if_<
typename Directed::is_directed_t, DirOutEdgeIter, UnDirOutEdgeIter
>::type unfiltered_out_edge_iter;
@@ -552,7 +552,7 @@ namespace boost {
vertex_descriptor, MatrixIter, size_type, edge_descriptor
> UnDirInEdgeIter;
typedef typename ct_if_t<
typedef typename mpl::if_<
typename Directed::is_directed_t, DirInEdgeIter, UnDirInEdgeIter
>::type unfiltered_in_edge_iter;

View File

@@ -739,7 +739,7 @@ private:
typedef graph_traits<BOOST_CSR_GRAPH_TYPE> traits;
typedef VertexProperty vertex_bundled;
typedef EdgeProperty edge_bundled;
typedef typename ct_if<(detail::is_vertex_bundle<vertex_bundled, edge_bundled, Bundle>::value),
typedef typename mpl::if_c<(detail::is_vertex_bundle<vertex_bundled, edge_bundled, Bundle>::value),
typename traits::vertex_descriptor,
typename traits::edge_descriptor>::type
descriptor;

View File

@@ -24,7 +24,9 @@
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/pending/ct_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/and.hpp>
#include <boost/graph/graph_concepts.hpp>
#include <boost/pending/container_traits.hpp>
#include <boost/graph/detail/adj_list_edge_iterator.hpp>
@@ -2273,7 +2275,7 @@ namespace boost {
typedef typename container_gen<VertexListS,
vertex_ptr>::type SeqVertexList;
typedef boost::integer_range<std::size_t> RandVertexList;
typedef typename boost::ct_if_t<is_rand_access,
typedef typename mpl::if_<is_rand_access,
RandVertexList, SeqVertexList>::type VertexList;
typedef typename VertexList::iterator vertex_iterator;
@@ -2283,10 +2285,10 @@ namespace boost {
typedef typename container_gen<EdgeListS,
list_edge<vertex_descriptor, EdgeProperty> >::type EdgeContainer;
typedef typename ct_and<DirectedT,
typename ct_not<BidirectionalT>::type >::type on_edge_storage;
typedef typename mpl::and_<DirectedT,
typename mpl::not_<BidirectionalT>::type >::type on_edge_storage;
typedef typename boost::ct_if_t<on_edge_storage,
typedef typename mpl::if_<on_edge_storage,
std::size_t, typename EdgeContainer::size_type
>::type edges_size_type;
@@ -2294,9 +2296,9 @@ namespace boost {
typedef typename detail::is_random_access<EdgeListS>::type is_edge_ra;
typedef typename boost::ct_if_t<on_edge_storage,
typedef typename mpl::if_<on_edge_storage,
stored_edge_property<vertex_descriptor, EdgeProperty>,
typename boost::ct_if_t<is_edge_ra,
typename mpl::if_<is_edge_ra,
stored_ra_edge_iter<vertex_descriptor, EdgeContainer, EdgeProperty>,
stored_edge_iter<vertex_descriptor, EdgeIter, EdgeProperty>
>::type
@@ -2347,7 +2349,7 @@ namespace boost {
typedef adj_list_edge_iterator<vertex_iterator, out_edge_iterator,
graph_type> DirectedEdgeIter;
typedef typename boost::ct_if_t<on_edge_storage,
typedef typename mpl::if_<on_edge_storage,
DirectedEdgeIter, UndirectedEdgeIter>::type edge_iterator;
// stored_vertex and StoredVertexList
@@ -2381,10 +2383,10 @@ namespace boost {
InEdgeList m_in_edges;
VertexProperty m_property;
};
typedef typename boost::ct_if_t<is_rand_access,
typename boost::ct_if_t<BidirectionalT,
typedef typename mpl::if_<is_rand_access,
typename mpl::if_<BidirectionalT,
bidir_rand_stored_vertex, rand_stored_vertex>::type,
typename boost::ct_if_t<BidirectionalT,
typename mpl::if_<BidirectionalT,
bidir_seq_stored_vertex, seq_stored_vertex>::type
>::type StoredVertex;
struct stored_vertex : public StoredVertex {
@@ -2394,20 +2396,20 @@ namespace boost {
typedef typename container_gen<VertexListS, stored_vertex>::type
RandStoredVertexList;
typedef typename boost::ct_if_t< is_rand_access,
typedef typename mpl::if_< is_rand_access,
RandStoredVertexList, SeqStoredVertexList>::type StoredVertexList;
}; // end of config
typedef typename boost::ct_if_t<BidirectionalT,
typedef typename mpl::if_<BidirectionalT,
bidirectional_graph_helper_with_property<config>,
typename boost::ct_if_t<DirectedT,
typename mpl::if_<DirectedT,
directed_graph_helper<config>,
undirected_graph_helper<config>
>::type
>::type DirectedHelper;
typedef typename boost::ct_if_t<is_rand_access,
typedef typename mpl::if_<is_rand_access,
vec_adj_list_impl<Graph, config, DirectedHelper>,
adj_list_impl<Graph, config, DirectedHelper>
>::type type;

View File

@@ -26,7 +26,7 @@
#include <algorithm>
#include <string>
#include <boost/config.hpp>
#include <boost/pending/ct_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/graph/detail/bitset_adaptor.hpp>
// This provides versions of std::bitset with both static and dynamic size.
@@ -594,7 +594,7 @@ namespace boost {
typename Allocator = std::allocator<WordType>
>
class bitset_generator {
typedef typename ct_if<N, select_dyn_size_bitset,
typedef typename mpl::if_c<N, select_dyn_size_bitset,
select_static_bitset>::type selector;
public:
typedef typename selector

View File

@@ -9,7 +9,7 @@
#ifndef BOOST_GRAPH_DETAIL_IS_SAME_HPP
#define BOOST_GRAPH_DETAIL_IS_SAME_HPP
#include <boost/pending/ct_if.hpp>
#include <boost/mpl/if.hpp>
namespace boost {
struct false_tag;
@@ -30,7 +30,7 @@ namespace boost {
template <class U, class V>
struct is_same {
enum { Unum = U::num, Vnum = V::num };
typedef typename boost::ct_if< (Unum == Vnum),
typedef typename mpl::if_c< (Unum == Vnum),
boost::true_tag, boost::false_tag>::type is_same_tag;
};
#endif

View File

@@ -13,7 +13,8 @@
#include <iterator>
#include <boost/config.hpp>
#include <boost/pending/ct_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/pending/integer_range.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
@@ -241,11 +242,11 @@ namespace boost {
template <class Cat>
struct is_random {
enum { RET = false };
typedef false_type type;
typedef mpl::false_ type;
};
template <>
struct is_random<std::random_access_iterator_tag> {
enum { RET = true }; typedef true_type type;
enum { RET = true }; typedef mpl::true_ type;
};
// The edge_list class conditionally inherits from one of the
@@ -262,7 +263,7 @@ namespace boost {
class Cat>
#endif
class edge_list
: public ct_if_t< typename is_random<Cat>::type,
: public mpl::if_< typename is_random<Cat>::type,
edge_list_impl_ra< edge_list<EdgeIter,T,D,Cat>, EdgeIter,T,D>,
edge_list_impl< edge_list<EdgeIter,T,D,Cat>, EdgeIter,T,D>
>::type

View File

@@ -10,6 +10,8 @@
#ifndef BOOST_GRAPH_SELECTORS_HPP
#define BOOST_GRAPH_SELECTORS_HPP
#include <boost/mpl/bool.hpp>
namespace boost {
//===========================================================================
@@ -17,18 +19,18 @@ namespace boost {
// and adjacency_matrix.
struct directedS { enum { is_directed = true, is_bidir = false };
typedef true_type is_directed_t;
typedef false_type is_bidir_t;
typedef mpl::true_ is_directed_t;
typedef mpl::false_ is_bidir_t;
};
struct undirectedS {
enum { is_directed = false, is_bidir = false };
typedef false_type is_directed_t;
typedef false_type is_bidir_t;
typedef mpl::false_ is_directed_t;
typedef mpl::false_ is_bidir_t;
};
struct bidirectionalS {
enum { is_directed = true, is_bidir = true };
typedef true_type is_directed_t;
typedef true_type is_bidir_t;
typedef mpl::true_ is_directed_t;
typedef mpl::true_ is_bidir_t;
};
} // namespace boost

View File

@@ -27,7 +27,6 @@
#include <boost/graph/bellman_ford_shortest_paths.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/pending/ct_if.hpp>
#include <boost/type_traits/same_traits.hpp>
namespace boost {

View File

@@ -361,11 +361,11 @@ namespace boost {
typedef graph_traits<Graph> traits;
typedef typename Graph::vertex_bundled vertex_bundled;
typedef typename Graph::edge_bundled edge_bundled;
typedef typename ct_if<(detail::is_vertex_bundle<vertex_bundled, edge_bundled, Bundle>::value),
typedef typename mpl::if_c<(detail::is_vertex_bundle<vertex_bundled, edge_bundled, Bundle>::value),
typename traits::vertex_descriptor,
typename traits::edge_descriptor>::type
descriptor;
typedef typename ct_if<(detail::is_vertex_bundle<vertex_bundled, edge_bundled, Bundle>::value),
typedef typename mpl::if_c<(detail::is_vertex_bundle<vertex_bundled, edge_bundled, Bundle>::value),
vertex_bundled,
edge_bundled>::type
actual_bundle;

View File

@@ -20,7 +20,7 @@
#include <boost/property_map_iterator.hpp>
#include <boost/graph/properties.hpp>
#include <boost/pending/ct_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/same_traits.hpp>
namespace boost {
@@ -34,7 +34,7 @@ namespace boost {
typedef typename property_map<Graph, PropertyTag>::const_type
const_map_type;
typedef typename property_kind<PropertyTag>::type Kind;
typedef typename ct_if<is_same<Kind, vertex_property_tag>::value,
typedef typename mpl::if_c<is_same<Kind, vertex_property_tag>::value,
typename graph_traits<Graph>::vertex_iterator,
typename graph_traits<Graph>::edge_iterator>::type iter;
public: