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;
|
std::vector<Value> values;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Value
|
||||||
struct Value {
|
{
|
||||||
enum class Type {
|
enum class Type
|
||||||
|
{
|
||||||
Invalid,
|
Invalid,
|
||||||
String,
|
String,
|
||||||
Number,
|
Number,
|
||||||
@ -151,51 +152,57 @@ struct Value {
|
|||||||
|
|
||||||
} // namespace osrm::util::json
|
} // namespace osrm::util::json
|
||||||
|
|
||||||
namespace std {
|
namespace std
|
||||||
template <typename T>
|
{
|
||||||
inline T& get(osrm::util::json::Value& value) noexcept;
|
template <typename T> inline T &get(osrm::util::json::Value &value) noexcept;
|
||||||
|
|
||||||
template <>
|
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;
|
return value.string;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
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;
|
return value.number;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
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;
|
return value.object;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
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;
|
return value.array;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> inline const T &get(const osrm::util::json::Value &value) noexcept;
|
||||||
inline const T& get(const osrm::util::json::Value& value) noexcept;
|
|
||||||
|
|
||||||
template <>
|
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;
|
return value.string;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
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;
|
return value.number;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
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;
|
return value.object;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user