overworked code for pull request #71
This commit is contained in:
parent
aca3f65bbe
commit
9cdd278f45
3 changed files with 20 additions and 3 deletions
|
@ -419,8 +419,8 @@ class basic_json
|
|||
{}
|
||||
|
||||
/// 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)
|
||||
inline basic_json(const int int_enum)
|
||||
: m_type(value_t::number_integer), m_value(static_cast<number_integer_t>(int_enum))
|
||||
{}
|
||||
|
||||
/// create an integer number (implicit)
|
||||
|
|
|
@ -418,6 +418,11 @@ class basic_json
|
|||
: m_type(value_t::number_integer), m_value(value)
|
||||
{}
|
||||
|
||||
/// create an int number to support enum type (implicit)
|
||||
inline basic_json(const int int_enum)
|
||||
: m_type(value_t::number_integer), m_value(static_cast<number_integer_t>(int_enum))
|
||||
{}
|
||||
|
||||
/// create an integer number (implicit)
|
||||
template<typename T, typename
|
||||
std::enable_if<
|
||||
|
|
|
@ -8529,4 +8529,16 @@ TEST_CASE("regression tests")
|
|||
CHECK(json(json::number_float_t(INFINITY)) == json());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("pull request #71 - handle enum type")
|
||||
{
|
||||
enum { t = 0 };
|
||||
json j = json::array();
|
||||
j.push_back(t);
|
||||
|
||||
j.push_back(json::object(
|
||||
{
|
||||
{"game_type", t}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue