Try to get rid of std::variant in json_container.hpp
This commit is contained in:
parent
dbc52728c3
commit
150c792f76
@ -117,9 +117,10 @@ struct Array
|
||||
std::vector<Value> values;
|
||||
};
|
||||
|
||||
|
||||
struct Value {
|
||||
enum class Type {
|
||||
struct Value
|
||||
{
|
||||
enum class Type
|
||||
{
|
||||
Invalid,
|
||||
String,
|
||||
Number,
|
||||
@ -151,51 +152,57 @@ struct Value {
|
||||
|
||||
} // namespace osrm::util::json
|
||||
|
||||
namespace std {
|
||||
template <typename T>
|
||||
inline T& get(osrm::util::json::Value& value) noexcept;
|
||||
namespace std
|
||||
{
|
||||
template <typename T> inline T &get(osrm::util::json::Value &value) noexcept;
|
||||
|
||||
template <>
|
||||
inline osrm::util::json::String& get<osrm::util::json::String>(osrm::util::json::Value& value) noexcept
|
||||
inline osrm::util::json::String &
|
||||
get<osrm::util::json::String>(osrm::util::json::Value &value) noexcept
|
||||
{
|
||||
return value.string;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline osrm::util::json::Number& get<osrm::util::json::Number>(osrm::util::json::Value& value) noexcept
|
||||
inline osrm::util::json::Number &
|
||||
get<osrm::util::json::Number>(osrm::util::json::Value &value) noexcept
|
||||
{
|
||||
return value.number;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline osrm::util::json::Object& get<osrm::util::json::Object>(osrm::util::json::Value& value) noexcept
|
||||
inline osrm::util::json::Object &
|
||||
get<osrm::util::json::Object>(osrm::util::json::Value &value) noexcept
|
||||
{
|
||||
return value.object;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline osrm::util::json::Array& get<osrm::util::json::Array>(osrm::util::json::Value& value) noexcept
|
||||
inline osrm::util::json::Array &
|
||||
get<osrm::util::json::Array>(osrm::util::json::Value &value) noexcept
|
||||
{
|
||||
return value.array;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline const T& get(const osrm::util::json::Value& value) noexcept;
|
||||
template <typename T> inline const T &get(const osrm::util::json::Value &value) noexcept;
|
||||
|
||||
template <>
|
||||
inline const osrm::util::json::String& get<osrm::util::json::String>(const osrm::util::json::Value& value) noexcept
|
||||
inline const osrm::util::json::String &
|
||||
get<osrm::util::json::String>(const osrm::util::json::Value &value) noexcept
|
||||
{
|
||||
return value.string;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline const osrm::util::json::Number& get<osrm::util::json::Number>(const osrm::util::json::Value& value) noexcept
|
||||
inline const osrm::util::json::Number &
|
||||
get<osrm::util::json::Number>(const osrm::util::json::Value &value) noexcept
|
||||
{
|
||||
return value.number;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline const osrm::util::json::Object& get<osrm::util::json::Object>(const osrm::util::json::Value& value) noexcept
|
||||
inline const osrm::util::json::Object &
|
||||
get<osrm::util::json::Object>(const osrm::util::json::Value &value) noexcept
|
||||
{
|
||||
return value.object;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user