diff --git a/common/json.h b/common/json.h index f3ad4edee8..95b6d6f212 100644 --- a/common/json.h +++ b/common/json.h @@ -82,6 +82,9 @@ struct common_json_value { // note: a nested pair {"a", "b"} does not build, use common_json::array({"a", "b"}) for an array common_json_value(std::initializer_list items); + template ::value, int>::type = 0> + common_json_value(T val) : common_json_value((typename std::underlying_type::type) val) {} + template ::value && !std::is_same::value, int>::type = 0> common_json_value(T val) : type(std::is_signed::value ? VAL_INT : VAL_UINT) { if (std::is_signed::value) { @@ -111,6 +114,7 @@ struct common_json_item { // the types common_json_value holds on its own // anything else reaches its common_json ctor and recurses forever template struct common_json_is_value : std::integral_constant::value || std::is_arithmetic::value || std::is_same::value || std::is_same::value ||