On Wed, Jun 29, 2016 at 11:58 AM, Alex Shaver <alexsha...@gmail.com> wrote:

> (proto3)
>
> Suppose I have some message with a repeated submessage element; especially
> given c++11's for range operator and other iterator-type algorithms, it
> feels like there should be iterator access to the submessages, beyond just
> the 'index' based approach.
>
> I may be missing the fact that it does exist somewhere (the c++
> documentation isn't up to date, really), or that there's other c++
> limitations (these submessages are stored in some way that iterator access
> is prohibitively difficult/impossible). Otherwise, it definitely seems like
> an important element in the modern c++ styles.
>
Suppose you have the following proto definition:

message Foo {
  repeated Foo children = 1;
}

You should be able to write code like:

Foo foo = ...;
for (const Foo& child : foo.children()) {
  ...
}


> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to