this is not doing exactly what Suraj asked for, as it modifies the
order of elements in the repeated field.
assuming order of the elements does matter, you have two options:
1. use the SwapElements() idiom in a loop until the element to be
removed is the last one and than call RemoveLast().
2. get the direct buffer using the mutable_data() method, use
memmove() or something similar, to pull the following elements into
place, place the element to be removed at the end and then call
RemoveLast()

unless you're dealing with extremely large arrays, method #1 should
suffice.

eyal.

On Oct 18, 2:10 am, Igor Gatis <igorga...@gmail.com> wrote:
> foo.mutable_repeated_field()->SwapElements(index_to_remove,
> foo.repeated_field_size()
> - 1);
> foo.mutable_repeated_field()->RemoveLast();
>
>
>
>
>
>
>
> On Mon, Oct 17, 2011 at 04:51, Suraj <surajn.v...@gmail.com> wrote:
> > Can we delete an entry at a particular index in a repeated member in a
> > protobuff object?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Protocol Buffers" group.
> > To post to this group, send email to protobuf@googlegroups.com.
> > To unsubscribe from this group, send email to
> > protobuf+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/protobuf?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to