$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [Serialization] [Serialization ofstlmapwithpointer to POD type]
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-12-31 15:51:48
Denis Gabaidulin wrote:
> Key never change, but value can.
so why store the key?
eg
const char * keytable[] {
"key1", // store keys at compile time in order
"key2",
...
}
unsigned int values [sizeof(keytable) / sizeof(const char *)];
unsigned int get_key_index(const char * k){
// look up key with binary search
}
Then just serialize the values array.
My real point is that if you find yourself wanting to
serialze a const value, your likely missing out on making
a much faster implementation.
Any time you feel the need to change a "const" value
it's a red flag that something can be done better.
Robert Ramey