build: Fix compilation on Ubuntu platform and add work-around for ndn-cxx regression
Note that on Ubuntu 12.04, either boost libraries or compiler needs to be upgraded.
Change-Id: I33f1089f961f99abf3d1803bf833e76ff7fb528d
Refs: #2379, #2380, #2382, #2381, #2383
diff --git a/helper/boost-graph-ndn-global-routing-helper.hpp b/helper/boost-graph-ndn-global-routing-helper.hpp
index 18a1a44..fe160f3 100644
--- a/helper/boost-graph-ndn-global-routing-helper.hpp
+++ b/helper/boost-graph-ndn-global-routing-helper.hpp
@@ -182,9 +182,9 @@
typedef readable_property_map_tag category;
};
-const property_traits<EdgeWeights>::value_type WeightZero(0, 0, 0.0);
+const property_traits<EdgeWeights>::value_type WeightZero(nullptr, 0, 0.0);
const property_traits<EdgeWeights>::value_type
- WeightInf(0, std::numeric_limits<uint16_t>::max(), 0.0);
+ WeightInf(nullptr, std::numeric_limits<uint16_t>::max(), 0.0);
struct WeightCompare : public std::binary_function<property_traits<EdgeWeights>::reference,
property_traits<EdgeWeights>::reference, bool> {
@@ -220,7 +220,7 @@
operator()(std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> a,
property_traits<EdgeWeights>::reference b) const
{
- if (std::get<0>(a) == 0)
+ if (std::get<0>(a) == nullptr)
return std::make_tuple(std::get<0>(b), std::get<1>(a) + std::get<1>(b),
std::get<2>(a) + std::get<2>(b));
else
@@ -270,7 +270,7 @@
get(const boost::EdgeWeights&, ns3::ndn::GlobalRouter::Incidency& edge)
{
if (std::get<1>(edge) == 0)
- return property_traits<EdgeWeights>::reference(0, 0, 0.0);
+ return property_traits<EdgeWeights>::reference(nullptr, 0, 0.0);
else {
return property_traits<EdgeWeights>::reference(std::get<1>(edge),
static_cast<uint16_t>(
@@ -305,13 +305,31 @@
typedef read_write_property_map_tag category;
};
+} // boost
+
+namespace std {
+template<>
+class numeric_limits<std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double>>
+{
+public:
+ typedef std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> value;
+ static value
+ max()
+ {
+ return boost::WeightInf;
+ }
+};
+}
+
+namespace boost {
+
inline std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double>
get(DistancesMap& map, ns3::Ptr<ns3::ndn::GlobalRouter> key)
{
boost::DistancesMap::iterator i = map.find(key);
if (i == map.end())
return std::tuple<std::shared_ptr<nfd::Face>, uint32_t,
- double>(0, std::numeric_limits<uint32_t>::max(), 0.0);
+ double>(nullptr, std::numeric_limits<uint32_t>::max(), 0.0);
else
return i->second;
}