thanks,this is what i looking for.
On Jul 30, 2:28 am, Kenton Varda <[email protected]> wrote:
> In C++, you can use the standard STL sort()
> function:http://www.sgi.com/tech/stl/sort.html
>
> <http://www.sgi.com/tech/stl/sort.html>RepeatedPtrField supports iterators,
> so you can do something like:
>
> #include <algorithm>
>
> struct StudentOrdering {
> inline operator()(const Student* a, const Student* b) {
> return a->score() < b->score();
> }
> }
>
> void SortStudents(Class* cls) {
> std::sort(cls->mutable_student()->begin(),
> cls->mutable_student()->end(),
> StudentOrdering());
> }
>
>
>
> On Tue, Jul 28, 2009 at 8:03 PM, 李海波 <[email protected]> wrote:
>
> > example:
> > ==========.proto file ============
> > message Class{
> > message Student{
> > required string name = 1;
> > required int32 score = 2;
> > }
>
> > repeated Student student = 1;
> > }
> > =============================
>
> > I want to sort students of the class by score,how can i do?- Hide quoted
> > text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
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
-~----------~----~----~----~------~----~------~--~---