OOOOOOK, so now I find the answer..

ExtensionSize(lights)

This is the right way to know the size;

But why don't google write it out int its documentation???

在 2014年4月2日星期三UTC+8下午9时19分31秒,Zhiqian Yuan写道:
>
> Hi guys,
>
>   I am blocked by this tricky issue. That is when I define a repeated 
> string field in one extension, I find there's no way to know the size of 
> that extension. For example:
>
>   extend Truck {
>     repeated string lights = 1001;
>   };
>  
>   In this case, if you would like to get one "light" string out from the 
> extension, you can surely call obj->GetExtension(lights, index); In this 
> way you may get the string stored at the position that index indicates; 
> however, there should be a way to know the total number of this field 
> anyway, otherwise you won't know where to stop, right?
>
>   Now this is the problem! There's simply no such a way for us to know the 
> size of "lights".
>
>   I have no idea, I checked the documentation and read the code. But I 
> haven't found any clue. Could anyone please help me? I appreciate a lot for 
> any clue you guys would share :)
>
> Regards
> Zhiqian
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to