cereal :C++11 序列化库

网友投稿 867 2022-11-04

cereal :C++11 序列化库

cereal :C++11 序列化库

cereal - A C++11 library for serialization

cereal is a header-only C++11 serialization library. cereal takes arbitrary data types and reversibly turns them into different representations, such as compact binary encodings, XML, or JSON. cereal was designed to be fast, light-weight, and easy to extend - it has no external dependencies and can be easily bundled with other code or used standalone.

cereal has great documentation

Looking for more information on how cereal works and its documentation? Visit cereal's web page to get the latest information.

cereal is easy to use

Installation and use of of cereal is fully documented on the main web page, but this is a quick and dirty version:

Download cereal and place the headers somewhere your code can see themWrite serialization functions for your custom types or use the built in support for the standard library cereal providesUse the serialization archives to load and save data

#include #include #include #include struct MyRecord{ uint8_t x, y; float z; template void serialize( Archive & ar ) { ar( x, y, z ); }}; struct SomeData{ int32_t id; std::shared_ptr> data; template void save( Archive & ar ) const { ar( data ); } template void load( Archive & ar ) { static int32_t idGen = 0; id = idGen++; ar( data ); }};int main(){ std::ofstream os("out.cereal", std::ios::binary); cereal::BinaryOutputArchive archive( os ); SomeData myData; archive( myData ); return 0;}

cereal has a mailing list

Either get in touch over email or on the web.

cereal has a permissive license

cereal is licensed under the BSD license.

cereal build status

Were you looking for the Haskell cereal? Go here.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Swift-JsonSerializer- 序列化工具
下一篇:JVM完全解读之GC日志记录分析
相关文章

 发表评论

暂时没有评论,来抢沙发吧~