数组感觉有点问题
#include "stdafx.h"
#include "iguana\json.hpp"
#include <iostream>
struct struct_A
{
int aa[2];
};
REFLECTION(struct_A, aa)
int main()
{
struct_A A = { {1,2} };
iguana::string_stream ss;
iguana::json::to_json(ss, A);
auto json_s = ss.str();
std::cout << json_s << std::endl;
struct_A A_;
iguana::json::from_json(A_, json_s.c_str());
return 0;
}
数组在from_json过不去,vector可以
@pykooh 这个bug现在已经修改了,你更新一下最新的代码试试。
我测试了上面这段代码,好像还是有点bug: iguana/iguana/json.hpp:119:25: error: ‘render_array’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] render_array(ss, v); ~~~~~~~~~~~~^~~~~~~
nie@nie-vm:build$ git log commit b0744a8d45359e4a21683efc5e8baa5c930eac3b Author: qicosmos [email protected] Date: Tue Apr 14 14:56:59 2020 +0800
fix from_json0
已解决:json.hpp:119 把render_json_value移到render_array后面即可
是现在的代码已经解决还是你自己解决的?
我自己解决的,代码json.hpp:117行的render_json_value要移到123行的render_array后面去。
这个代码太厉害了,可视化了一个54KB的超大结构体,开始会报stack smashing detected错误,把string_stream.hpp中的m_length调大后解决了。