0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-30 04:38:52 +02:00

ircd::json: Add uint64_t ctor to value.

This ctor is actually not supposed to be used, so it gives a
pseudo-narrowing warning. Not having this ctor simply gives a compile error
which makes very little sense to the developer who is simply trying to pass
a commonly used size_t et al.
This commit is contained in:
Jason Volk 2017-11-25 14:07:25 -07:00
parent b42dffb24c
commit 5e9a82af86

View file

@ -139,6 +139,7 @@ struct ircd::json::value
namespace ircd::json
{
template<> value::value(const double &floating);
template<> value::value(const uint64_t &integer);
template<> value::value(const int64_t &integer);
template<> value::value(const float &floating);
template<> value::value(const int32_t &integer);
@ -291,6 +292,13 @@ ircd::json::value::value(const double &floating)
,floats{true}
{}
template<>
__attribute__((warning("uint64_t narrows to int64_t when used in json::value")))
inline
ircd::json::value::value(const uint64_t &integer)
:value{int64_t(integer)}
{}
template<> inline
ircd::json::value::value(const float &floating)
:value{double(floating)}