Ai
12 Star 25 Fork 8

丁宁/ajson

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
example2_basic.cpp 676 Bytes
一键复制 编辑 原始数据 按行查看 历史
lordoffox 提交于 2016-12-09 14:35 +08:00 . update example for v0.2.1
#include <iostream>
#include <string>
#include <vector>
#include "ajson.hpp"
using namespace std;
using namespace ajson;
struct Education
{
string School;
double GPA;
Education():GPA(0.0){}
Education(const string& school , double gpa)
:School(school),GPA(gpa)
{
}
};
struct Person
{
string Name;
int Age;
vector<Education> Educations;
};
AJSON(Education , School , GPA)
AJSON(Person, Name , Age , Educations)
int main(int argc, char * argv[])
{
Person person;
person.Name = "Bob";
person.Age = 28;
person.Educations.push_back(Education("MIT",600));
string_stream ss;
save_to(ss,person);
std::cout << ss.str() << std::endl;
cin.get();
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/lordoffox/ajson.git
git@gitee.com:lordoffox/ajson.git
lordoffox
ajson
ajson
master

搜索帮助