Note operator JSONValue&() const meant jw.operator const JSONValue&() the same as jw as in
cout<<render_json_value(jw)<<endl;
#include <vector>
#include <map>
#include <boost\variant.hpp>
typedef decltype(nullptr) nullptr_t;
struct JSONWrapper;
using JSONArray = std::vector<JSONWrapper>;
typedef std::map<std::string, JSONArray> JSONObject;
using JSONValue = boost::variant<bool, double, std::string, nullptr_t, JSONArray, JSONObject>;
struct JSONWrapper {
JSONValue value;
operator JSONValue&() { return value; }
operator const JSONValue&() const { return value; }
};
Friday, December 2, 2016
boost variant defines JSON Wrapper
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment