mt_allocator issues.

Stefan Olsson stefan@xapa.se
Mon Mar 15 08:54:00 GMT 2004


Dhruv Matani wrote:

>On Sat, 2004-03-13 at 20:50, Stefan Olsson wrote:
>  
>
>>Hi Dhruv,
>>
>>you are right. The original version was SGI style:
>>template<int __inst> class __mt_alloc
>>and since __inst was unused (and set to zero) there was only one 
>>instance. However this changed when it was turned into a standards 
>>compliant allocator:
>>template<typename _Tp> class __mt_alloc
>>
>>As of right now (late saturday afternoon) I'm not sure if this is a good 
>>or bad thing, but it was never the less not originally intended this way!
>>
>>Is it possible (through keywords/compiler options) to get the static 
>>members "application  wide" instead of one copy per template? Or do we 
>>have to define them elsewhere to get back to square one?
>>    
>>
>
>I would rather leave that to the maintainers but just to provide an
>alternative:
>
>1. Make __mt_alloc non-templated and make a new template wrapper which
>derives from the non-templated one.
>
>2. Make the static data part of a separate class, and make mt_alloc
>derive from that.
>
>3. Use an unnamed namespace.
>
>All 3 seem quite reasonable to me, though, time-wise, 3 would be the
>best.
>
Personally I feel that #1 is the way to go even though this to some 
extent is going back to the old SGI style -> standards style wrapper thingy.

Comments are greatly appriciated! I intend to address this, the "atomic" 
issue and maybe also a change of name within the next couple of days.

Brgds

/Stefan



More information about the Libstdc++ mailing list