I'm trying to access the underlying array of a deserialized RepeatedField 
class.  My settings class contains a RepeatedField<float> called vertices 
which I would like to access as an array of floats.

I have tried copying the data to a std::vector but this does not work due 
to iterator and offset being out of range.

std::vector<float> vertices;
>
> vertices.reserve(settings.vertices().size());
>
> std::copy(settings.vertices().begin(), settings.vertices().end(), 
>> vertices.begin());
>
>
The data is to be passed into another method which requires a pointer to an 
array of floats. 

I have also tried passing the mutable_data() property directly but this 
gives an error of

'google::protobuf::RepeatedField<Element>::mutable_data' : cannot convert 
> 'this' pointer from 'const google::protobuf::RepeatedField<Element>' to 
> 'google::protobuf::RepeatedField<Element> &'
>
 
Any ideas?
 

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/3wI3hGHySDEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to