reply to self: I guess you copy the item from the end of the list into
the space formerly occupied by the item you want to delete, then call
RemoveLast()...


On Sep 16, 4:27 pm, [EMAIL PROTECTED] wrote:
> OK, rephrase that question. Say you have a releated field containing
> 10 items.  You wish to delete the 2nd item so that the list contains 9
> items and foo_size() returns 9. Is that possible?
>
> I can't see an erase() function in mutable_foo(), and I can't see
> anything in RepeatedField that decrements current_size_ other than
> RemoveLast() which presumably will only remove the _last_ item?
>
> Currently the only way to remove elements from a list seems to be
> awful hacks like a.parse(a.serialise()) after clearing the items you
> want to delete
>
> On Aug 12, 9:05 pm, "Kenton Varda" <[EMAIL PROTECTED]> wrote:
>
> > For C++, use the RepeatedField 
> > interfaces:http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google...
>
> > You can get a mutable pointer to a RepeatedField or RepeatedPtrField that
> > represents a field named "foo" by calling the message's "mutable_foo()"
> > accessor.
>
> > For Python, I think you currently have to clear the field and repopulate it.
>
> > On Tue, Aug 12, 2008 at 12:22 PM, <[EMAIL PROTECTED]> wrote:
>
> > > Python or C++
>
> > > On Aug 12, 8:12 pm, "Kenton Varda" <[EMAIL PROTECTED]> wrote:
> > > > In what language?
>
> > > > On Tue, Aug 12, 2008 at 12:11 PM, <[EMAIL PROTECTED]> wrote:
>
> > > > > Given an object containing a repeated field, is it possible to remove
> > > > > some arbitrary element from that list?
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to