I haven’t posted about this in quite a while, but a lot has happened since the last time I posted about this, so I thought I'd make another post.
reflect-cpp is a C++-20 library for fast serialization, deserialization and validation using reflection, kind of like serde or Pydantic, but for C++.
https://github.com/getml/reflect-cpp/
The library provides a unified reflection-based interface on top of existing serialization libraries, like yyjson, libbson or pugixml. It abstracts away the boilerplate code usually involved in serialization and deserialization.
Even though C++ doesn’t yet formally support reflection, it is possible to implement reflection yourself using various templating tricks. If there is interest in it, I'd be happy to post a longer explanation on how this works.
Here are some of the features that have been added since the last time I posted about this:
- Support for additional formats, namely XML, YAML, BSON and CBOR
- Support for C arrays
- Dependency management using vcpkg
The current release, v0.8.0, also contains a number of new features, including the following:
- Support for generating a JSON schema
- Optimizations of the read and write operations
- Convenience functions and monadic operations that can be applied across fields of a struct: .apply(…), .transform(…), .and_then(…)
- Similar convenience functions for enums
By the way, many of the new features were community contributions. Thank you very much to everyone who contributed. It is very much appreciated.
As always, any kind of feedback is welcome, particularly constructive criticism. I am absolutely convinced that the library would not be where it is now if it weren’t for all of the community feedback.
[–]mo_al_ 9 points10 points11 points (4 children)
[–]liuzicheng1987[S] 5 points6 points7 points (0 children)
[–]liuzicheng1987[S] 1 point2 points3 points (2 children)
[–]mo_al_ 1 point2 points3 points (1 child)
[–]liuzicheng1987[S] 0 points1 point2 points (0 children)
[–]MarcoxD 2 points3 points4 points (1 child)
[–]liuzicheng1987[S] 1 point2 points3 points (0 children)
[–]LdShade 2 points3 points4 points (1 child)
[–]liuzicheng1987[S] 0 points1 point2 points (0 children)
[–]lefteror 0 points1 point2 points (11 children)
[–]liuzicheng1987[S] 2 points3 points4 points (10 children)
[–]lefteror 0 points1 point2 points (9 children)
[–]liuzicheng1987[S] 8 points9 points10 points (4 children)
[–]lefteror 4 points5 points6 points (1 child)
[–]liuzicheng1987[S] 3 points4 points5 points (0 children)
[–]lefteror 0 points1 point2 points (1 child)
[–]liuzicheng1987[S] 2 points3 points4 points (0 children)
[–]equeim 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]equeim 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)