For the purposes of reflection, maps are treated like a repeated field of messages, where each message has a key in field 1 and a value in field 2. The Descriptor type has map_key() <https://github.com/protocolbuffers/protobuf/blob/125dfd343e823e0b16209520d0c6d2c63f713bb2/src/google/protobuf/descriptor.h#L523> and map_value() methods to make it easy to get ahold of the key and value field descriptors.
On Tue, Apr 26, 2022 at 8:05 AM Yuhui ZHI <[email protected]> wrote: > > https://stackoverflow.com/questions/71995707/how-to-use-reflection-of-protobuf-to-modify-a-map > > I just don't know how to use reflection to set a google::protobuf::Map. > > Can someone show me an example? > > -- > 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/83e20e38-162a-4a20-98db-86b9fc547091n%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/83e20e38-162a-4a20-98db-86b9fc547091n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CADqAXr5xcHEec03ERBVdoyCtjq5L0JnuNKeXMqsHcKt_y37NfQ%40mail.gmail.com.
