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
<https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.descriptor#Descriptor.field.details>
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?
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/protobuf/60dd959d-892a-407e-92b3-aaccc1f429aan%40googlegroups.com.