Get rid of unused functions in util/json_util.hpp (#6446)

This commit is contained in:
Siarhei Fedartsou
2022-11-06 21:13:04 +01:00
committed by GitHub
parent aeaf5e0735
commit 5f82d0c9ba
3 changed files with 1 additions and 47 deletions
-22
View File
@@ -1,22 +0,0 @@
#ifndef CONTAINER_HPP
#define CONTAINER_HPP
#include <utility>
namespace osrm
{
namespace util
{
template <class Container> void append_to_container(Container &&) {}
template <class Container, typename T, typename... Args>
void append_to_container(Container &&container, T value, Args &&... args)
{
container.emplace_back(value);
append_to_container(std::forward<Container>(container), std::forward<Args>(args)...);
}
} // namespace util
} // namespace osrm
#endif
-25
View File
@@ -2,7 +2,6 @@
#define JSON_UTIL_HPP
#include "osrm/json_container.hpp"
#include "util/container.hpp"
#include <cmath>
#include <limits>
@@ -27,30 +26,6 @@ template <typename T> T clamp_float(T d)
return d;
}
template <typename... Args> Array make_array(Args... args)
{
Array a;
// TODO: check why a.values.emplace_back(args...); is not an option here
append_to_container(a.values, args...);
return a;
}
// Easy acces to object hierachies
inline Value &get(Value &value) { return value; }
template <typename... Keys> Value &get(Value &value, const char *key, Keys... keys)
{
using recursive_object_t = mapbox::util::recursive_wrapper<Object>;
return get(value.get<recursive_object_t>().get().values[key], keys...);
}
template <typename... Keys> Value &get(Value &value, unsigned key, Keys... keys)
{
using recursive_array_t = mapbox::util::recursive_wrapper<Array>;
return get(value.get<recursive_array_t>().get().values[key], keys...);
}
} // namespace json
} // namespace util
} // namespace osrm