With some work you can implement this functionality using protobuf reflection. However I would strongly recommend against using required fields at all, if you can avoid them. Changing an existing field from required to optional is dangerous, but it's a good idea to avoid required fields from the start when creating new message types.
On Wed, Oct 16, 2019 at 11:07 AM Gaurav Bhosale <[email protected]> wrote: > I have proto file ( target for C++ ) > message Test1 > { > message Test2 > { > required double x = 1; > } > required double y = 1; > > } > > > I want initialize Test1 message without using mutable_**** > Or > Without using set fields function in C++ > > Means, is it possible that, > > Test1 test_message; > test_message = new Test1(); > > and all fields initialized to zero or default value? > Is there any single function, which will do initialize all fields of > nested message in C++? > > > > > > > > -- > 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/d1d576a0-7944-408d-ae10-a0007d14cddd%40googlegroups.com > . > -- 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/CADqAXr6k9sLtQhyf8ZED46hr2Z%3DPS-eUaFAR0y%2B3rxoezjwnUQ%40mail.gmail.com.
