Skip to content

laoning2008/struct_pack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strcut_pack

Copy from alibaba/yalantinglibs

quick example

#include <struct_pack/struct_pack.hpp>
#include <vector>

struct person {
  int64_t id;
  std::string name;
  int age;
  double salary;
};

int main(int argc, char** argv) {
    person person1{.id = 1, .name = "hello struct pack", .age = 20, .salary = 1024.42};

    // one line code serialize
    std::vector<char> buffer = struct_pack::serialize(person1);

    // one line code deserialization
    auto person2 = struct_pack::deserialize<person>(buffer);

    return 0;
}

About

c++ struct serialization library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages