mirror of
https://github.com/nlohmann/json.git
synced 2024-08-20 20:12:26 +02:00
support enum
construct enum type to basic_json (proxy by int type) ``` enum { t = 0 }; json j = json::array(); j.push_back(t); j.push_back(json::object({ {"game_type", t} })); ```
This commit is contained in:
parent
9f9d293bad
commit
91aee10579
|
@ -418,6 +418,11 @@ class basic_json
|
||||||
: m_type(value_t::number_integer), m_value(value)
|
: m_type(value_t::number_integer), m_value(value)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
/// create an int number to support enum type (implicit)
|
||||||
|
inline basic_json(int int_enum)
|
||||||
|
: m_type(value_t::number_integer), m_value((NumberIntegerType)int_enum)
|
||||||
|
{}
|
||||||
|
|
||||||
/// create an integer number (implicit)
|
/// create an integer number (implicit)
|
||||||
template<typename T, typename
|
template<typename T, typename
|
||||||
std::enable_if<
|
std::enable_if<
|
||||||
|
|
Loading…
Reference in a new issue