I have some entries in the repeated field in my proto. Now I want delete some of them. How can I accomplish this? There is a function to delete the last element, but I want to d
Protobuf v2
You can use the DeleteSubrange(int start, int num) in RepeatedPtrField
class.
If you want to delete a single element then you have to call this method as DeleteSubrange(index_to_be_del, 1)
. It will remove the element at that index.
Protobuf v3 update
As mentioned in the comments, iterator RepeatedField::erase(const_iterator position) can delete at arbitrary position