cppreflect | C reflection portable library | Reflection library
kandi X-RAY | cppreflect Summary
kandi X-RAY | cppreflect Summary
C++ reflection portable library
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cppreflect
cppreflect Key Features
cppreflect Examples and Code Snippets
Community Discussions
Trending Discussions on cppreflect
QUESTION
I have a serializable
struct in struct.h that I am serializing in serialize.h using a custom serialization method. If a change is made to my serializable
struct I need to make sure that a corresponding change in made in serialize.h as well.
Typical method of reflection use some macros for this. But the nature of our struct and the way we massage the data during serialization does not work well for this.
Is there some way to do some static compile time check so if the serializable
struct is changed in any way without changing the serialize.h then the build will fail.
One way I have thought of but prefer to do it as last resort is to make a copy of definition of serializable
struct in serialize.h and use boost::is_same check with error message asking for corresponding change in serialize.h
ANSWER
Answered 2020-Apr-22 at 01:12We decided to just do a checksum verifications for the code. If the serializable
struct is modified then the static_assert will fail and the error message asks to update the code and the checksum.
This was a compromise we made to make code easier to read and at the same time ensure we don't forget updating serialization.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cppreflect
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page