Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/boost/graph/adjacency_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#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 <type_traits>
#include <boost/detail/workaround.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/named_graph.hpp>
Expand Down Expand Up @@ -187,20 +187,20 @@ namespace detail
{
value = false
};
typedef mpl::false_ type;
typedef std::false_type type;
};
template <> struct is_random_access< vecS >
{
enum
{
value = true
};
typedef mpl::true_ type;
typedef std::true_type type;
};

} // namespace detail

template < typename Selector > struct is_distributed_selector : mpl::false_
template < typename Selector > struct is_distributed_selector : std::false_type
{
};

Expand Down
58 changes: 34 additions & 24 deletions include/boost/graph/detail/labeled_graph_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include <boost/graph/graph_mutability_traits.hpp>

#include <type_traits>

namespace boost
{

Expand Down Expand Up @@ -84,105 +86,111 @@ struct labeled_add_only_property_graph_tag

template < typename Graph >
struct graph_has_add_vertex_by_label
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_vertex_tag >::value >
{
};

template < typename Graph >
struct graph_has_add_vertex_by_label_with_property
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_vertex_property_tag >::value >
{
};

template < typename Graph >
struct graph_has_remove_vertex_by_label
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_remove_vertex_tag >::value >
{
};

template < typename Graph >
struct graph_has_add_edge_by_label
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_edge_tag >::value >
{
};

template < typename Graph >
struct graph_has_add_edge_by_label_with_property
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_edge_property_tag >::value >
{
};

template < typename Graph >
struct graph_has_remove_edge_by_label
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_remove_edge_tag >::value >
{
};

template < typename Graph >
struct is_labeled_mutable_vertex_graph
: mpl::and_< graph_has_add_vertex_by_label< Graph >,
graph_has_remove_vertex_by_label< Graph > >
: std::integral_constant< bool,
graph_has_add_vertex_by_label< Graph >::value
&& graph_has_remove_vertex_by_label< Graph >::value >
{
};

template < typename Graph >
struct is_labeled_mutable_vertex_property_graph
: mpl::and_< graph_has_add_vertex_by_label< Graph >,
graph_has_remove_vertex_by_label< Graph > >
: std::integral_constant< bool,
graph_has_add_vertex_by_label< Graph >::value
&& graph_has_remove_vertex_by_label< Graph >::value >
{
};

template < typename Graph >
struct is_labeled_mutable_edge_graph
: mpl::and_< graph_has_add_edge_by_label< Graph >,
graph_has_remove_edge_by_label< Graph > >
: std::integral_constant< bool,
graph_has_add_edge_by_label< Graph >::value
&& graph_has_remove_edge_by_label< Graph >::value >
{
};

template < typename Graph >
struct is_labeled_mutable_edge_property_graph
: mpl::and_< graph_has_add_edge_by_label< Graph >,
graph_has_remove_edge_by_label< Graph > >
: std::integral_constant< bool,
graph_has_add_edge_by_label< Graph >::value
&& graph_has_remove_edge_by_label< Graph >::value >
{
};

template < typename Graph >
struct is_labeled_mutable_graph
: mpl::and_< is_labeled_mutable_vertex_graph< Graph >,
is_labeled_mutable_edge_graph< Graph > >
: std::integral_constant< bool,
is_labeled_mutable_vertex_graph< Graph >::value
&& is_labeled_mutable_edge_graph< Graph >::value >
{
};

template < typename Graph >
struct is_labeled_mutable_property_graph
: mpl::and_< is_labeled_mutable_vertex_property_graph< Graph >,
is_labeled_mutable_edge_property_graph< Graph > >
: std::integral_constant< bool,
is_labeled_mutable_vertex_property_graph< Graph >::value
&& is_labeled_mutable_edge_property_graph< Graph >::value >
{
};

template < typename Graph >
struct is_labeled_add_only_property_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
labeled_add_only_property_graph_tag >::value >
{
};

template < typename Graph >
struct is_labeled_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
label_vertex_tag >::value >
{
Expand All @@ -197,13 +205,15 @@ namespace graph_detail
// graph_mutability_traits specialization below.
template < typename Graph > struct determine_mutability
{
typedef typename mpl::if_< is_add_only_property_graph< Graph >,
typedef typename std::conditional<
is_add_only_property_graph< Graph >::value,
labeled_add_only_property_graph_tag,
typename mpl::if_< is_mutable_property_graph< Graph >,
typename std::conditional< is_mutable_property_graph< Graph >::value,
labeled_mutable_property_graph_tag,
typename mpl::if_< is_mutable_graph< Graph >,
typename std::conditional< is_mutable_graph< Graph >::value,
labeled_mutable_graph_tag,
typename mpl::if_< is_mutable_edge_graph< Graph >,
typename std::conditional<
is_mutable_edge_graph< Graph >::value,
labeled_graph_tag,
typename graph_mutability_traits< Graph >::category >::
type >::type >::type >::type type;
Expand Down
45 changes: 26 additions & 19 deletions include/boost/graph/graph_mutability_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#define BOOST_GRAPH_MUTABILITY_TRAITS_HPP

#include <boost/config.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/bool.hpp>
#include <type_traits>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_same.hpp>

Expand Down Expand Up @@ -90,94 +88,103 @@ template < typename Graph > struct graph_mutability_traits

template < typename Graph >
struct graph_has_add_vertex
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_vertex_tag >::value >
{
};

template < typename Graph >
struct graph_has_add_vertex_with_property
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_vertex_property_tag >::value >
{
};

template < typename Graph >
struct graph_has_remove_vertex
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
remove_vertex_tag >::value >
{
};

template < typename Graph >
struct graph_has_add_edge
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_edge_tag >::value >
{
};

template < typename Graph >
struct graph_has_add_edge_with_property
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_edge_property_tag >::value >
{
};

template < typename Graph >
struct graph_has_remove_edge
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
remove_edge_tag >::value >
{
};

template < typename Graph >
struct is_mutable_vertex_graph
: mpl::and_< graph_has_add_vertex< Graph >, graph_has_remove_vertex< Graph > >
: std::integral_constant< bool,
graph_has_add_vertex< Graph >::value
&& graph_has_remove_vertex< Graph >::value >
{
};

template < typename Graph >
struct is_mutable_vertex_property_graph
: mpl::and_< graph_has_add_vertex_with_property< Graph >,
graph_has_remove_vertex< Graph > >
: std::integral_constant< bool,
graph_has_add_vertex_with_property< Graph >::value
&& graph_has_remove_vertex< Graph >::value >
{
};

template < typename Graph >
struct is_mutable_edge_graph
: mpl::and_< graph_has_add_edge< Graph >, graph_has_remove_edge< Graph > >
: std::integral_constant< bool,
graph_has_add_edge< Graph >::value
&& graph_has_remove_edge< Graph >::value >
{
};

template < typename Graph >
struct is_mutable_edge_property_graph
: mpl::and_< graph_has_add_edge_with_property< Graph >,
graph_has_remove_edge< Graph > >
: std::integral_constant< bool,
graph_has_add_edge_with_property< Graph >::value
&& graph_has_remove_edge< Graph >::value >
{
};

template < typename Graph >
struct is_mutable_graph
: mpl::and_< is_mutable_vertex_graph< Graph >, is_mutable_edge_graph< Graph > >
: std::integral_constant< bool,
is_mutable_vertex_graph< Graph >::value
&& is_mutable_edge_graph< Graph >::value >
{
};

template < typename Graph >
struct is_mutable_property_graph
: mpl::and_< is_mutable_vertex_property_graph< Graph >,
is_mutable_edge_property_graph< Graph > >
: std::integral_constant< bool,
is_mutable_vertex_property_graph< Graph >::value
&& is_mutable_edge_property_graph< Graph >::value >
{
};

template < typename Graph >
struct is_add_only_property_graph
: mpl::bool_<
: std::integral_constant< bool,
is_convertible< typename graph_mutability_traits< Graph >::category,
add_only_property_graph_tag >::value >
{
Expand Down
14 changes: 7 additions & 7 deletions include/boost/graph/graph_selectors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef BOOST_GRAPH_SELECTORS_HPP
#define BOOST_GRAPH_SELECTORS_HPP

#include <boost/mpl/bool.hpp>
#include <type_traits>

namespace boost
{
Expand All @@ -26,8 +26,8 @@ struct directedS
is_directed = true,
is_bidir = false
};
typedef mpl::true_ is_directed_t;
typedef mpl::false_ is_bidir_t;
using is_directed_t = std::true_type;
using is_bidir_t = std::false_type;
};
struct undirectedS
{
Expand All @@ -36,8 +36,8 @@ struct undirectedS
is_directed = false,
is_bidir = false
};
typedef mpl::false_ is_directed_t;
typedef mpl::false_ is_bidir_t;
using is_directed_t = std::false_type;
using is_bidir_t = std::false_type;
};
struct bidirectionalS
{
Expand All @@ -46,8 +46,8 @@ struct bidirectionalS
is_directed = true,
is_bidir = true
};
typedef mpl::true_ is_directed_t;
typedef mpl::true_ is_bidir_t;
using is_directed_t = std::true_type;
using is_bidir_t = std::true_type;
};

} // namespace boost
Expand Down
Loading
Loading