Update
I'm digging Arena document.
(https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.arena)
But if any expert who know better way plz tell me.
I wonder whether it's available using arena or not.
Thanks!
2018년 1월 4일 목요일 오후 9시 14분 31초 UTC+9, 기준 님의 말:
>
> I'm testing protocol buffers, but encountered segment fault that i can't
> understand.
>
> My protocol buffer is below
>
> ```
> message Sub {
> string value = 1;
> }
>
> message Wrapping {
> int32 key = 1;
> repeated Sub sub = 2;
> }
> ```
>
> Testing code is below
>
> ```
> void Test()
> {
> gbtest::Sub* sub = new gbtest::Sub();
>
> for(int i = 0 ; i<4 ; ++i)
> {
> gbtest::Wrapping wrapping; // Local variable
> wrapping.mutable_sub()->AddAllocated(sub);
> wrapping.set_key(i);
>
> std::cout << "Size -> " << wrapping->mutable_sub()->size() <<
> std::endl;
> }
> }
> ```
>
>
>
>
> I want copy sub's pointer to each newed wrapping rather than copy it's
> data.
>
>
> How can i achieve this?
> Plz tell me how.
>
> Thanks.
>
>
>
>
>
>
>
>
>
>
>
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.