Commit de6e73a2 authored by Tiago Peixoto's avatar Tiago Peixoto

Fix compilation issues with clang++

parent 01fd54e2
......@@ -83,11 +83,11 @@ AC_ARG_ENABLE([optimization], [AS_HELP_STRING([--disable-optimization],[disable
if test $enableval = no; then
[AC_MSG_RESULT(no)]
else
[CXXFLAGS="${CXXFLAGS} -O99"]
[CXXFLAGS="${CXXFLAGS} -O3"]
[AC_MSG_RESULT(yes)]
fi
,
[CXXFLAGS="${CXXFLAGS} -O99"]
[CXXFLAGS="${CXXFLAGS} -O3"]
[AC_MSG_RESULT(yes)]
)
......
......@@ -44,7 +44,7 @@ struct get_assortativity_coefficient
typedef typename mpl::if_<typename is_directed::apply<Graph>::type,
size_t, double>::type count_t;
count_t c = (is_directed::apply<Graph>::type::value) ? 1.0 : 0.5;
count_t c = (is_directed::apply<Graph>::type::value) ? count_t(1) : count_t(0.5);
count_t n_edges = 0;
count_t e_kk = 0;
tr1::unordered_map<double,count_t> a, b;
......@@ -124,7 +124,7 @@ struct get_scalar_assortativity_coefficient
typedef typename mpl::if_<typename is_directed::apply<Graph>::type,
size_t, double>::type count_t;
count_t c = (is_directed::apply<Graph>::type::value) ? 1.0 : 0.5;
count_t c = (is_directed::apply<Graph>::type::value) ? count_t(1) : count_t(0.5);
count_t n_edges = 0;
double e_xy = 0.0;
double a = 0.0, b = 0.0, da = 0.0, db = 0.0;
......
This diff is collapsed.
......@@ -36,11 +36,6 @@ struct get_line_graph
typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
typedef boost::property<edge_index_t, size_t> EdgeProperty;
typedef typename property_map<LineGraph, vertex_index_t>::type
line_vertex_index_map_t;
line_vertex_index_map_t line_vertex_index(get(boost::vertex_index,
line_graph));
typedef typename graph_traits<LineGraph>::vertex_descriptor lg_vertex_t;
typedef HashedDescriptorMap<EdgeIndexMap,lg_vertex_t>
edge_to_vertex_map_t;
......
......@@ -164,7 +164,39 @@ void print_progress(size_t i, size_t n_iter, size_t current, size_t total,
}
}
class DegreeBlock;
//select blocks based on in/out degrees
class DegreeBlock
{
public:
typedef pair<size_t, size_t> block_t;
template <class Graph>
block_t get_block(typename graph_traits<Graph>::vertex_descriptor v,
const Graph& g) const
{
return make_pair(in_degreeS()(v, g), out_degree(v, g));
}
};
//select blocks based on property map
template <class PropertyMap>
class PropertyBlock
{
public:
typedef typename property_traits<PropertyMap>::value_type block_t;
PropertyBlock(PropertyMap p): _p(p) {}
template <class Graph>
block_t get_block(typename graph_traits<Graph>::vertex_descriptor v,
const Graph& g) const
{
return get(_p, v);
}
private:
PropertyMap _p;
};
// main rewire loop
template <template <class Graph, class EdgeIndexMap, class CorrProb,
......@@ -616,40 +648,6 @@ private:
_probs;
};
//select blocks based on in/out degrees
class DegreeBlock
{
public:
typedef pair<size_t, size_t> block_t;
template <class Graph>
block_t get_block(typename graph_traits<Graph>::vertex_descriptor v,
const Graph& g) const
{
return make_pair(in_degreeS()(v, g), out_degree(v, g));
}
};
//select blocks based on property map
template <class PropertyMap>
class PropertyBlock
{
public:
typedef typename property_traits<PropertyMap>::value_type block_t;
PropertyBlock(PropertyMap p): _p(p) {}
template <class Graph>
block_t get_block(typename graph_traits<Graph>::vertex_descriptor v,
const Graph& g) const
{
return get(_p, v);
}
private:
PropertyMap _p;
};
} // graph_tool namespace
#endif // GRAPH_REWIRING_HH
......@@ -20,10 +20,14 @@
// follow the requirements of the GNU GPL in regard to all of the
// software in the executable aside from CGAL.
#if (GCC_VERSION < 40400)
#if (GCC_VERSION < 40400 || defined __clang__)
# define CGAL_CFG_NO_TR1_ARRAY
# define CGAL_CFG_NO_TR1_TUPLE
#endif
#ifdef __clang__
# define CGAL_CFG_ARRAY_MEMBER_INITIALIZATION_BUG
#endif
#include <CGAL/version.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
......@@ -33,7 +37,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Triangulation_3<Kernel> SimpleTriangulation;
typedef CGAL::Delaunay_triangulation_3<Kernel> DelaunayTriangulation;
namespace std
namespace CGAL
{
bool operator==(const SimpleTriangulation::Vertex& a,
const SimpleTriangulation::Vertex& b)
......@@ -49,7 +53,7 @@ bool operator==(const SimpleTriangulation::Vertex& a,
typedef CGAL::Periodic_3_triangulation_traits_3<Kernel> GT;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT>
PeriodicDelaunayTriangulation;
namespace std
namespace CGAL
{
bool operator==(const PeriodicDelaunayTriangulation::Vertex& a,
const PeriodicDelaunayTriangulation::Vertex& b)
......
......@@ -52,7 +52,7 @@ class gml_parse_error: public std::exception
public:
gml_parse_error(const string& w): _what(w) {}
~gml_parse_error() throw() {}
std::string what() {return _what;}
virtual const char* what() const throw() {return _what.c_str();}
private:
std::string _what;
......
......@@ -154,9 +154,8 @@ public:
private:
// Generic graph_action functor. See graph_filtering.hh for details.
template <class Action,
class TR1=boost::mpl::vector<>, class TR2=boost::mpl::vector<>,
class TR3=boost::mpl::vector<>, class TR4=boost::mpl::vector<> >
template <class Action, class GraphViews, class Wrap, class TR1, class TR2,
class TR3, class TR4>
friend struct detail::graph_action;
// python interface
......
......@@ -55,16 +55,6 @@ uint8_t lexical_cast<uint8_t,string>(const string& val)
// preserve internal representation. (we also need to make sure the
// representation is locale-independent).
template <class Val>
int print_float(char*& str, Val val)
{
char* locale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C");
int retval = print_float_dispatch(str, val);
setlocale(LC_NUMERIC, locale);
return retval;
}
int print_float_dispatch(char*& str, float val)
{
return asprintf(&str, "%a", val);
......@@ -81,11 +71,11 @@ int print_float_dispatch(char*& str, long double val)
}
template <class Val>
int scan_float(const char* str, Val& val)
int print_float(char*& str, Val val)
{
char* locale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C");
int retval = scan_float_dispatch(str, val);
int retval = print_float_dispatch(str, val);
setlocale(LC_NUMERIC, locale);
return retval;
}
......@@ -105,6 +95,17 @@ int scan_float_dispatch(const char* str, long double& val)
return sscanf(str, "%La", &val);
}
template <class Val>
int scan_float(const char* str, Val& val)
{
char* locale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C");
int retval = scan_float_dispatch(str, val);
setlocale(LC_NUMERIC, locale);
return retval;
}
template <>
string lexical_cast<string,float>(const float& val)
{
......
......@@ -155,7 +155,7 @@ struct label_biconnected_components
{
HistogramPropertyMap<CompMap> cm(comp_map, num_edges(g), hist);
biconnected_components(g, cm,
vertex_inserter<ArtMap>(art_map)).first;
vertex_inserter<ArtMap>(art_map));
}
};
......
......@@ -15,11 +15,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "graph.hh"
#include "graph_filtering.hh"
#include <boost/graph/transitive_closure.hpp>
#include "graph_filtering.hh"
#include "graph.hh"
#include "graph_properties.hh"
using namespace graph_tool;
using namespace boost;
......
Markdown is supported
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