Skip to content

yezhizi/serilite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serilite

serilite is designed to be a simple and easy to use serialization library for C++17. You can easily serialize and deserialize your objects with just a few lines of code and without any boilerplate code. For example, you can serialize a simple object like this:

#include <serilite.hpp>
YourObject obj;
auto serialized_res = serilite::serialize(obj);
auto serialized_view = serialized_res.as_string_view();
auto serialized_string = serialized_res.as_string();
// ....
YourObject obj2
serilite::deserialize(serialized_res,obj2);
serilite::deserialize(serialized_view,obj2);
serilite::deserialize(serialized_string,obj2);

No need to write any serialization or deserialization code for your objects or modify them in any way.

Supported types

srilite supports the most of frequently used types, including:

  • Trivially copyable type
  • Can be constructed by std::memcpy from a byte representation. This includes all scalar types, arrays or vector of trivially copyable types.
  • Has iterator, which means T::iterator and T::value_type are defined.
  • Aggregate type with fileds of supported types, and fileds count less than 64.
  • std::tuple and std::pair of supported types.

References

C++序列化对象 Counting the number of fields in an aggregate in C++20

About

A lightweight C++ serialization library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published