Do I have a typo (or some other misunderstanding) or is there no support for iterators with RepeatedPtrFields ? Iterators are only available in RepeatedFields ?google::protobuf::RepeatedPtrField<std::string>&::iterator it = message->locations().begin()
Gave me a compilation error that there was no iterator in the global namespace. Looking at the docs for RepeatedPtrField it doesn't mention iterators, and RepeatedPtrField doesn't seem to inherit from RepeatedField - the docs suggest the two objects are similar (but doesn't mention any inheritance either).
Iterating using locations().Get(index) works fine as a workaround but I was wondering if the lack of iterators was a conscious thing ?
Andrew 8-)
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
On Wed, Apr 14, 2010 at 1:15 PM, Andrew Kimpton <awki...@gmail.com> wrote:Do I have a typo (or some other misunderstanding) or is there no support for iterators with RepeatedPtrFields ? Iterators are only available in RepeatedFields ?google::protobuf::RepeatedPtrField<std::string>&::iterator it = message->locations().begin()The '&' is extraneous - it's splitting up the type you want, hence the compiler is trying to find the type ::iterator.