qicosmos / kapok Goto Github PK
View Code? Open in Web Editor NEW更好的序列化库,c++14开发,header-only,简洁高效。Now there is a better serialization libray:https://github.com/qicosmos/iguana please replace kapok with iguana.
License: Apache License 2.0
更好的序列化库,c++14开发,header-only,简洁高效。Now there is a better serialization libray:https://github.com/qicosmos/iguana please replace kapok with iguana.
License: Apache License 2.0
vs2013编译不通过
大神不知道能给个编译的教程吗?我在vs2015中编译各种报错。
测试代码如下:
struct UserClass {
int x;
char y;
std::string z;
META(x, y, z);
bool operator==(const UserClass& u) {
return u.x == x && u.y == y && u.z == z;
}
};
std::cout << "user class array test..." << std::endl;
UserClass user_array1[] = { { 1, 'a', "hello" }, { 2, 'b', "world" }};
UserClass user_array2[2];
sr.Serialize(user_array1, "array1");
dr.Parse(sr.GetString());
dr.Deserialize(user_array2, "array1");
assert(user_array1[0] == user_array2[0] && user_array1[1] == user_array2[1]);
std::cout << "pass" << std::endl;
在 dr.Deserialize(user_array2, "array1");处编译错误(注释掉该行则可正常编译).
举个例子,如果Kapok.hpp分别被a.cpp和b.cpp include,a.cpp b.cpp被分别编译成a.o b.o,然后这两个.o文件被link程一个可执行文件,那么link的时候会出现multiple definition of Int2String这个错误。 目前我用一个山寨的方法 const char* Int2String[] ==> static const char* Int2String[]来解决这个问题
template<size_t N = 0, typename T>
auto ReadValue(T&& t, Value& val, std::false_type bo) -> std::enable_if_t<is_tuple<T>::value>
{
assert(!val.IsArray());
decltype(auto) tuple_elem = std::get<N>(t);
auto it = val.MemberBegin() + N;
assert(0 == std::strcmp(tuple_elem.first, it->name.GetString()));
ReadObject(tuple_elem, (Value&)(it->value), bo);
}
这里tuple跟json的顺序相关了。为什么不遍历查找匹配?
kapok/traits.hpp:84:1: warning: multi-line comment [-Wcomment]
//#define IS_SMART_POINTER(token)\
像上面这样
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.