|
Boost : |
From: Michael Goldshteyn (mgoldshteyn_at_[hidden])
Date: 2006-02-02 10:44:31
"Thorsten Ottosen" <tottosen_at_[hidden]> wrote in message
news:drsf4g$hob$1_at_sea.gmane.org...
> Michael Goldshteyn wrote:
>> Thorsten, the biggest problem I have found with libraries that offer this
>> optimization, and I am glad that VC++ 7.1's is one of them, is that the
>> definition of "short" is non-configurable, except by changing a very
>> important header file. Even if a change to that header file is made,
>> there
>> is no guarantee that the compiler actually reads the header file and does
>> not have its contents hardcoded when an include directive for that header
>> file is seen in source code, since the header file is a "standard" (i.e.
>> included with the compiler) header file.
>>
>> For example, in VC++, IIRC, it is set to somewhere in the neighborhood of
>> 15. I would much rather that they upped this value to 31 or 63, or
>> somewhere
>> thereabouts.
>
> maybe std::char_traits could container such a constant?
>
> -Thorsten
It's hard to say, but whatever the place chosen it should be compatible with
similar extensions to other containers:
- vector (i.e. how does it scale as the reserve is exceeded?)
- deque (i.e. how can the page size be set by the programmer?)
- hash_* (i.e. how can an initial hash table size be reserved? how does it
grow when the reserve is exceeded?)
So, in this light, perhaps char_traits isn't the right place, but I am not
sure what is, short of adding another template parameter to specify a
growth/initial_size policy.
Michael Goldshteyn
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk