Commit f22bdb74 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Disambiguate between is_directed_ metafunction and is_directed()

This fixes compilation with older GCC versions (ca. 5.0.0).
parent d9ddaf60
......@@ -182,7 +182,7 @@ struct get_trust_transitivity
else
{
typedef typename
mpl::if_<typename is_directed::apply<Graph>::type,
mpl::if_<typename is_directed_::apply<Graph>::type,
reversed_graph<fg_t>,
fg_t>::type rg_t;
rg_t rg(fg);
......
......@@ -258,7 +258,7 @@ struct wrap_undirected
template <class Graph>
struct apply
{
typedef typename mpl::if_<typename is_directed::apply<Graph>::type,
typedef typename mpl::if_<typename is_directed_::apply<Graph>::type,
boost::undirected_adaptor<Graph>,
Graph&>::type type;
};
......@@ -269,7 +269,7 @@ struct wrap_directed
template <class Graph, class Sub>
struct apply
{
typedef typename mpl::if_<typename is_directed::apply<Graph>::type,
typedef typename mpl::if_<typename is_directed_::apply<Graph>::type,
Sub&,
boost::undirected_adaptor<Sub>>::type type;
};
......
......@@ -411,7 +411,7 @@ bool is_source(const pair<size_t, size_t>& deg)
template <class Graph>
bool is_target(const pair<size_t, size_t>& deg)
{
if (is_directed::apply<Graph>::type::value)
if (is_directed_::apply<Graph>::type::value)
return deg.first > 0;
else
return is_source<Graph>(deg);
......@@ -441,7 +441,7 @@ struct gen_graph
get(vertex_index_t(), g);
// figure out the necessary strategy
typedef typename mpl::if_<typename is_directed::apply<Graph>::type,
typedef typename mpl::if_<typename is_directed_::apply<Graph>::type,
DirectedStrat,
UndirectedStrat>::type gen_strat_t;
......
......@@ -39,7 +39,7 @@ struct get_price
void operator()(Graph& g, size_t N, double gamma, double c, size_t m,
rng_t& rng) const
{
typedef typename mpl::if_<typename is_directed::apply<Graph>::type,
typedef typename mpl::if_<typename is_directed_::apply<Graph>::type,
in_degreeS, out_degreeS>::type DegSelector;
map<double, typename graph_traits<Graph>::vertex_descriptor> probs;
......
......@@ -145,7 +145,7 @@ struct copy_edge_property_dispatch
{
auto s = source(e, src);
auto t = target(e, src);
if (!is_directed::apply<GraphSrc>::type::value && s > t)
if (!is_directed_::apply<GraphSrc>::type::value && s > t)
continue;
size_t ei = src_edge_index[e];
const auto& new_e = index_map[ei];
......
......@@ -58,7 +58,7 @@ namespace graph_tool
// useful metafunction to determine whether a graph is directed or not
struct is_directed
struct is_directed_
{
template <class Graph>
struct apply
......@@ -71,7 +71,7 @@ struct is_directed
template <class Graph>
constexpr bool is_directed(const Graph&)
{
return is_directed::apply<std::remove_reference_t<Graph>>::type::value;
return is_directed_::apply<std::remove_reference_t<Graph>>::type::value;
}
// This will count "by hand" the number of vertices on a graph. Always O(V).
......@@ -228,10 +228,10 @@ auto get_dir(const boost::filt_graph<Graph, EPred, VPred>& g,
template <class Graph, class F>
void parallel_edge_loop_no_spawn(const Graph& g, F&& f)
{
auto&& u = get_dir(g, typename is_directed::apply<Graph>::type());
auto&& u = get_dir(g, typename is_directed_::apply<Graph>::type());
typedef typename std::remove_const
<typename std::remove_reference<decltype(u)>::type>::type graph_t;
static_assert(is_directed::apply<graph_t>::type::value,
static_assert(is_directed_::apply<graph_t>::type::value,
"graph must be directed at this point");
auto dispatch =
[&](auto v)
......
......@@ -1083,7 +1083,7 @@ public:
if (t == u)
{
t = v;
if (!is_directed::apply<g_t>::type::value)
if (!is_directed_::apply<g_t>::type::value)
{
assert(w % 2 == 0);
w /= 2;
......@@ -1122,7 +1122,7 @@ public:
}
}
if (is_directed::apply<g_t>::type::value)
if (is_directed_::apply<g_t>::type::value)
{
ns_u.clear();
ns_v.clear();
......@@ -1283,7 +1283,7 @@ public:
size_t kout = out_degreeS()(v, _g, _eweight);
size_t kin = kout;
if (is_directed::apply<g_t>::type::value)
if (is_directed_::apply<g_t>::type::value)
kin = in_degreeS()(v, _g, _eweight);
int dwr = _vweight[v];
......@@ -1349,7 +1349,7 @@ public:
else
deltap[s] += _eweight[e];
}
if (!is_directed::apply<g_t>::type::value)
if (!is_directed_::apply<g_t>::type::value)
deltal /= 2;
vector<int> deltam(num_vertices(_bg), 0);
......@@ -1382,7 +1382,7 @@ public:
int ers = (r != null_group) ? get_beprop(r, s, _mrs, _emat) : 0;
int enrs = (nr != null_group) ? get_beprop(nr, s, _mrs, _emat) : 0;
if (!is_directed::apply<g_t>::type::value)
if (!is_directed_::apply<g_t>::type::value)
{
if (s != nr && s != r)
{
......@@ -2039,7 +2039,7 @@ public:
if (c > 0)
{
size_t B = _candidate_blocks.size() - 1;
if (is_directed::apply<g_t>::type::value)
if (is_directed_::apply<g_t>::type::value)
p_rand = c * B / double(_mrp[t] + _mrm[t] + c * B);
else
p_rand = c * B / double(_mrp[t] + c * B);
......@@ -2134,7 +2134,7 @@ public:
int mst = mts;
int mtm = mtp;
if (is_directed::apply<g_t>::type::value)
if (is_directed_::apply<g_t>::type::value)
{
mst = 0;
const auto& me = m_entries.get_me(s, t, _emat);
......@@ -2147,7 +2147,7 @@ public:
{
int dts = m_entries.get_delta(t, s);
int dst = dts;
if (is_directed::apply<g_t>::type::value)
if (is_directed_::apply<g_t>::type::value)
dst = m_entries.get_delta(s, t);
mts += dts;
......@@ -2166,7 +2166,7 @@ public:
}
}
if (is_directed::apply<g_t>::type::value)
if (is_directed_::apply<g_t>::type::value)
{
p += ew * ((mts + mst + c) / (mtp + mtm + c * B));
}
......@@ -2449,7 +2449,7 @@ public:
for (auto e : out_edges_range(v, _g))
{
auto u = target(e, _g);
if (u < v && !is_directed::apply<g_t>::type::value)
if (u < v && !is_directed_::apply<g_t>::type::value)
continue;
us[u] += _eweight[e];
}
......@@ -2460,7 +2460,7 @@ public:
auto& m = uc.second;
if (m > 1)
{
if (u == v && !is_directed::apply<g_t>::type::value)
if (u == v && !is_directed_::apply<g_t>::type::value)
{
assert(m % 2 == 0);
S += lgamma_fast(m/2 + 1) + m * log(2) / 2;
......@@ -2595,7 +2595,7 @@ public:
target(e, _g)) < _b.get_storage().size());
size_t r = _b[source(e, _g)];
size_t s = _b[target(e, _g)];
if (!is_directed::apply<g_t>::type::value && s < r)
if (!is_directed_::apply<g_t>::type::value && s < r)
std::swap(r, s);
mrs[std::make_pair(r, s)] += _eweight[e];
}
......@@ -2630,7 +2630,7 @@ public:
{
auto r = source(me, _bg);
auto s = target(me, _bg);
if (!is_directed::apply<g_t>::type::value && s < r)
if (!is_directed_::apply<g_t>::type::value && s < r)
std::swap(r, s);
auto m_rs = mrs[std::make_pair(r, s)];
if (m_rs != size_t(_mrs[me]))
......@@ -2661,7 +2661,7 @@ public:
//private:
typedef typename
std::conditional<is_directed::apply<g_t>::type::value,
std::conditional<is_directed_::apply<g_t>::type::value,
GraphInterface::multigraph_t,
undirected_adaptor<GraphInterface::multigraph_t>>::type
bg_t;
......
......@@ -47,7 +47,7 @@ public:
{
assert(get_me(source(e, bg),target(e, bg)) == _null_edge);
_mat[source(e, bg)][target(e, bg)] = e;
if (!is_directed::apply<BGraph>::type::value)
if (!is_directed_::apply<BGraph>::type::value)
_mat[target(e, bg)][source(e, bg)] = e;
}
}
......@@ -63,7 +63,7 @@ public:
void put_me(vertex_t r, vertex_t s, const edge_t& e)
{
_mat[r][s] = e;
if (!is_directed::apply<BGraph>::type::value && r != s)
if (!is_directed_::apply<BGraph>::type::value && r != s)
_mat[s][r] = e;
}
......@@ -72,7 +72,7 @@ public:
auto r = source(me, bg);
auto s = target(me, bg);
_mat[r][s] = _null_edge;
if (!is_directed::apply<BGraph>::type::value)
if (!is_directed_::apply<BGraph>::type::value)
_mat[s][r] = _null_edge;
//remove_edge(me, bg);
}
......@@ -166,7 +166,7 @@ public:
__attribute__((flatten)) __attribute__((hot))
const auto& get_me(vertex_t r, vertex_t s) const
{
if (!is_directed::apply<BGraph>::type::value && r > s)
if (!is_directed_::apply<BGraph>::type::value && r > s)
std::swap(r, s);
auto& map = _hash[r];
const auto& iter = map.find(s);
......@@ -177,7 +177,7 @@ public:
void put_me(vertex_t r, vertex_t s, const edge_t& e)
{
if (!is_directed::apply<BGraph>::type::value && r > s)
if (!is_directed_::apply<BGraph>::type::value && r > s)
std::swap(r, s);
assert(r < _hash.size());
_hash[r][s] = e;
......@@ -187,7 +187,7 @@ public:
{
auto r = source(me, bg);
auto s = target(me, bg);
if (!is_directed::apply<BGraph>::type::value && r > s)
if (!is_directed_::apply<BGraph>::type::value && r > s)
std::swap(r, s);
assert(r < _hash.size());
auto& r_hash = _hash[r];
......
......@@ -130,7 +130,7 @@ public:
{
_r_out_field.resize(B, _null);
_nr_out_field.resize(B, _null);
if (is_directed::apply<Graph>::type::value)
if (is_directed_::apply<Graph>::type::value)
{
_r_in_field.resize(B, _null);
_nr_in_field.resize(B, _null);
......@@ -145,7 +145,7 @@ public:
{
_r_out_field.resize(B, _null);
_nr_out_field.resize(B, _null);
if (is_directed::apply<Graph>::type::value)
if (is_directed_::apply<Graph>::type::value)
{
_r_in_field.resize(B, _null);
_nr_in_field.resize(B, _null);
......@@ -159,7 +159,7 @@ public:
size_t& get_field_rnr(size_t s, size_t t)
{
auto& out_field = First ? _r_out_field : _nr_out_field;
if (is_directed::apply<Graph>::type::value)
if (is_directed_::apply<Graph>::type::value)
{
auto& in_field = (First ? _r_in_field : _nr_in_field);
return (Source || s == t) ? out_field[t] : in_field[s];
......
......@@ -733,7 +733,7 @@ struct Layers
{
auto get_x = [](size_t B)
{
if (is_directed::apply<typename BaseState::g_t>::type::value)
if (is_directed_::apply<typename BaseState::g_t>::type::value)
return B * B;
else
return (B * (B + 1)) / 2;
......
......@@ -1633,7 +1633,7 @@ public:
//private:
typedef typename
std::conditional<is_directed::apply<g_t>::type::value,
std::conditional<is_directed_::apply<g_t>::type::value,
GraphInterface::multigraph_t,
undirected_adaptor<GraphInterface::multigraph_t>>::type
bg_t;
......
......@@ -375,7 +375,7 @@ public:
template <bool First, bool Source, bool Add, class... DVals>
void insert_delta_rnr(size_t t, size_t s, int d, DVals... delta)
{
if (!is_directed::apply<Graph>::type::value && (t > s))
if (!is_directed_::apply<Graph>::type::value && (t > s))
std::swap(t, s);
_entries[_pos] = make_pair(t, s);
if (Add)
......@@ -395,7 +395,7 @@ public:
int get_delta(size_t t, size_t s)
{
if (!is_directed::apply<Graph>::type::value && (t > s))
if (!is_directed_::apply<Graph>::type::value && (t > s))
std::swap(t, s);
for (size_t i = 0; i < 2; ++i)
{
......@@ -435,7 +435,7 @@ public:
template <class Emat>
const bedge_t& get_me(size_t t, size_t s, Emat& emat)
{
if (!is_directed::apply<Graph>::type::value && (t > s))
if (!is_directed_::apply<Graph>::type::value && (t > s))
std::swap(t, s);
for (size_t i = 0; i < 2; ++i)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment