From 91aee105798df4a9c74f51d75d897f70bdbf855f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=93=E6=80=9D=E9=BE=99?= Date: Sat, 9 May 2015 17:44:10 +0800 Subject: [PATCH] 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} })); ``` --- src/json.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/json.hpp b/src/json.hpp index fc0562e8..aab37e5e 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -417,6 +417,11 @@ class basic_json inline basic_json(const number_integer_t& 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) template