Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created February 22, 2016 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save springmeyer/d7495ddce73fe0ee722b to your computer and use it in GitHub Desktop.
Save springmeyer/d7495ddce73fe0ee722b to your computer and use it in GitHub Desktop.
diff --git a/include/util/json_util.hpp b/include/util/json_util.hpp
index 00f4501..32a1bd7 100644
--- a/include/util/json_util.hpp
+++ b/include/util/json_util.hpp
@@ -36,28 +36,6 @@ template <typename... Args> Array make_array(Args... args)
return a;
}
-template <typename T> Array make_array(const std::vector<T> &vector)
-{
- Array a;
- for (const auto &v : vector)
- {
- a.values.emplace_back(v);
- }
- return a;
-}
-
-//// template specialization needed as clang does not play nice
-//// FIXME this now causes compile errors on g++ -_-
-//template <> Array make_array(const std::vector<bool> &vector)
-//{
-// Array a;
-// for (const bool v : vector)
-// {
-// a.values.emplace_back(v);
-// }
-// return a;
-//}
-
// Easy acces to object hierachies
inline Value &get(Value &value) { return value; }
diff --git a/include/util/matching_debug_info.hpp b/include/util/matching_debug_info.hpp
index 4b782b7..cdd3651 100644
--- a/include/util/matching_debug_info.hpp
+++ b/include/util/matching_debug_info.hpp
@@ -120,7 +120,15 @@ struct MatchingDebugInfo
return;
}
- json::get(*object, "breakage") = json::make_array(breakage);
+ // convert std::vector<bool> to osrm::json::Array
+ json::Array a;
+ for (const bool v : breakage)
+ {
+ if (v) a.values.emplace_back(json::True());
+ else a.values.emplace_back(json::False());
+ }
+
+ json::get(*object, "breakage") = std::move(a);
}
const json::Logger *logger;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment