Well, that depends on how you set up your map. You could instead make the
key a pointer to the protobuf field, and define your comparator so that it
dereferences the pointer. Of course you need to make sure that the pointer
is actually valid: if you mutate the field you may invalidate the pointer.
If you're concerned about that, another approach would be to make your key
type a pointer to the entire protobuf value, and have the comparator look at
the field. When doing lookups in the map, you will need to construct a dummy
protobuf to use as the lookup key.

On Tue, Nov 16, 2010 at 9:49 PM, Ma Jin <maxu...@gmail.com> wrote:

>
> I try to use the pb to store a group of record with the same schema.
> I wonder to know whether the key of the properties would be copied for
> every record like map<key, value>.
> if like this, it seems to a waste of memory.
>
> --
> 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.

Reply via email to