We can't make it a template parameter because it would break reflection, which depends on being able to find the RepeatedField objects via pointer offsets. If it doesn't know exactly which template instance of RepeatedField it is looking for it wouldn't work.
On Tue, Mar 16, 2010 at 2:00 PM, Kenton Varda <ken...@google.com> wrote: > You can, of course, modify the value all you want in your copy of the code. > However, the value is only useful if it is a compile-time constant, so we > can't really parameterize it in general. Note that if you change the value, > you must recompile libprotobuf and anything you have that depends on it. > > > On Tue, Mar 16, 2010 at 5:39 AM, Thorsten <schu...@gmail.com> wrote: > >> Hi all, >> >> let's say you have a large number of messages of the same type in >> memory. One field of this type is marked as repeated: >> message Test { >> repeated uint64 foo = 1; >> } >> RepeatedField defines the default size to be 4. If most of my objects >> have 5 foos, I waste a lot of memory. >> >> Is it possible to make kInitialSize into a template parameter of >> RepeatedField? Thatway I could have different default sizes for >> different message types. The message description could provide an >> option for setting a new default length: >> message Test { >> repeated uint64 foo = 1 [default_size=5]; >> } >> >> Cheers, >> Thorsten >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Protocol Buffers" group. >> To post to this group, send email to proto...@googlegroups.com. >> To unsubscribe from this group, send email to >> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/protobuf?hl=en. >> >> > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.