fix compilation on gcc-6
This commit is contained in:
parent
c136f67398
commit
2ee7399b6f
@ -84,17 +84,13 @@ inline bool operator==(optional_type<T> const& lhs, optional_type<T> const& rhs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct type_helper
|
|
||||||
{
|
|
||||||
using type = T;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace nlohmann
|
namespace nlohmann
|
||||||
{
|
{
|
||||||
template <>
|
template <>
|
||||||
struct json_traits<udt::empty_type> : type_helper<udt::empty_type>
|
struct json_traits<udt::empty_type>
|
||||||
{
|
{
|
||||||
|
using type = udt::empty_type;
|
||||||
|
|
||||||
static json to_json(type)
|
static json to_json(type)
|
||||||
{
|
{
|
||||||
return json::object();
|
return json::object();
|
||||||
@ -108,8 +104,10 @@ struct json_traits<udt::empty_type> : type_helper<udt::empty_type>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct json_traits<udt::pod_type> : type_helper<udt::pod_type>
|
struct json_traits<udt::pod_type>
|
||||||
{
|
{
|
||||||
|
using type = udt::pod_type;
|
||||||
|
|
||||||
static json to_json(type const& t)
|
static json to_json(type const& t)
|
||||||
{
|
{
|
||||||
return {{"a", t.a}, {"b", t.b}, {"c", t.c}};
|
return {{"a", t.a}, {"b", t.b}, {"c", t.c}};
|
||||||
@ -124,8 +122,9 @@ struct json_traits<udt::pod_type> : type_helper<udt::pod_type>
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct json_traits<udt::bit_more_complex_type>
|
struct json_traits<udt::bit_more_complex_type>
|
||||||
: type_helper<udt::bit_more_complex_type>
|
|
||||||
{
|
{
|
||||||
|
using type = udt::bit_more_complex_type;
|
||||||
|
|
||||||
static json to_json(type const& t)
|
static json to_json(type const& t)
|
||||||
{
|
{
|
||||||
return json{{"a", json{t.a}}, {"b", json{t.b}}, {"c", t.c}};
|
return json{{"a", json{t.a}}, {"b", json{t.b}}, {"c", t.c}};
|
||||||
@ -139,8 +138,11 @@ struct json_traits<udt::bit_more_complex_type>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct json_traits<udt::optional_type<T>> : type_helper<udt::optional_type<T>> {
|
struct json_traits<udt::optional_type<T>>
|
||||||
static json to_json(type const&t)
|
{
|
||||||
|
using type = udt::optional_type<T>;
|
||||||
|
|
||||||
|
static json to_json(type const& t)
|
||||||
{
|
{
|
||||||
if (t)
|
if (t)
|
||||||
return json(*t);
|
return json(*t);
|
||||||
@ -297,4 +299,4 @@ TEST_CASE("get<> for user-defined types", "[udt]")
|
|||||||
CHECK(*v == expected);
|
CHECK(*v == expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user