How to delete arbitrary objects in repeated field? (protobuf)

后端 未结 5 1219
广开言路
广开言路 2021-02-18 17:51

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

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-18 18:26

    What I usually do in these cases is to create a new Protobuf (PB) message. I iterate the repeated fields of the existing message and add them (except the ones you don't want anymore) to the new PB message.

提交回复
热议问题