replace constructor by from/to_json: unscoped enum types
this also means that one can do: j.get<unscoped_enum>();
This commit is contained in:
parent
f00898331e
commit
6d427acdde
3 changed files with 41 additions and 21 deletions
|
@ -63,10 +63,18 @@ TEST_CASE("regression tests")
|
|||
|
||||
SECTION("pull request #71 - handle enum type")
|
||||
{
|
||||
enum { t = 0 };
|
||||
enum { t = 0 , u = 1};
|
||||
json j = json::array();
|
||||
j.push_back(t);
|
||||
|
||||
// maybe this is not the place to test this?
|
||||
json j2 = u;
|
||||
|
||||
auto anon_enum_value = j2.get<decltype(u)>();
|
||||
CHECK(u == anon_enum_value);
|
||||
|
||||
static_assert(std::is_same<decltype(anon_enum_value), decltype(u)>::value, "");
|
||||
|
||||
j.push_back(json::object(
|
||||
{
|
||||
{"game_type", t}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue