I noticed that if I have a message with a repeated field of an enumeration 
type, such as:

message foo {
    enum bar_e {
       BAR_VALUE_1
    }
   repeated bar_e bars = 1;
}

The code generation seems to have an error in typing when accessing the 
repeated field. I would expect that the line:

    foo.bars()

to return me a RepeatedField<bar_e>, but it actually returns 
RepeatedField<int32>. I understand that enums and int32 are convertible, 
but it seems ... strange.

This is evident when I try to use the C++11 for loops, because this doesn't 
work:

    for (bar_e bar: foo.bars())

Instead, I have to do something like:

   for (int bar_int : foo.bars())

and then static_cast it to the enumeration ... or use a standard for loop, 
since foo.bar(x) returns the enum as you would expect.

Is this intended behavoir? And if so, why?

Thanks!
    

-- 
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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to