I'm working with Protobuf3 in my C++14 project.
Let's say that I have such a message in some proto file:
message User {
uint32 user_id = 1;
string user_name = 2;
map<string, string> others = 10;
};
Now, I'm trying to use the reflection mechanism in some functions to process this message.
I need to get the field counts of the message User, which should be 3.
The doc told me that there was a function
field_count(), which can give me the 3.
However, it seems that this is a common runtime function. I could work with it but I want to make come compile warning/error with static_assert. So I need this 3 at compile time.
Is it possible to get the field counts of a message at compile time?