c++ - Converting google::protobuf::RepeatedField<float> to float -


i using google's protobuf create c++ class called foo, follows:

message foo {     optional int32 x = 1;     repeated float y = 2; } 

in created c++ class, creates member variable y of type const google::protobuf::repeatedfield<float>. now, in c++ code, want access x , y variables of instance of foo, called foo. in example, y of length one, i.e. contains 1 float:

int = foo.x(); float b = foo.y(); float c = foo.y()[0]; 

here, first line works, errors both second , third lines. trying value of float stored in y.

how should doing this?

thanks!

you want:

float b = foo.y(0); 

(stack overflow complaining answer short...)


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

node.js - Express and Redis - If session exists for this user, don't allow access -

excel - I can't get the attachement of the email PHP -