search

Home  >  Q&A  >  body text

c++ - protobuf repeated 怎么用的?

是否可以用这个字段传输很多个该类型的数据?

怪我咯怪我咯2803 days ago1274

reply all(4)I'll reply

  • 黄舟

    黄舟2017-04-17 11:11:19

    Yes, repeated means that the field is an array of the specified type.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 11:11:19

    There is a list in java

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 11:11:19

    The data type of protobuf repeated is similar to C ’s Vector and list, and can only transmit the same data type. Of course, if you want to transmit multiple data types, you can use a method similar to C union, using a large message. Each field of the message is marked with optional. When you are processing the business, you can only use one field at a time. Assignment can also achieve the purpose.
    In addition: repeated can only indicate whether there is data or not. When there is no data, there is ambiguity in whether to keep the original data or delete all data. Additional fields are required for processing.
    http://blog.csdn.net/chenxiaohong3905/article/details/6929430
    http://blog.csdn.net/chenxiaohong3905/article/details/6906459

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 11:11:19

    The protobuf repeated type is equivalent to the vector of std. It can be used to store N contents of the same type. I found an article to introduce the usage of protobuf repeated.
    http://blog.csdn.net/mycwq/ar...

    reply
    0
  • Cancelreply