help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stl_alloc substitution


From: Bernd Strieder
Subject: Re: stl_alloc substitution
Date: Mon, 09 Jun 2008 10:01:49 +0200
User-agent: KNode/0.10.4

Hello,

oliverpelz@googlemail.com wrote:

> Hello everybody,
> 
> I am trying to port some old gcc2 code to gcc-Version 4.0.3 (Ubuntu
> 4.0.3-1ubuntu5).
> When I try to "make" the compiler complains that
> 
> _Alloc_traitsĀ« is not a template.
> 
> After searching for a while i came to the conclusion that this
> template is not more in gcc4,
> the stl_alloc is obsolete and removed.
> So how can I substitute templates such as
> ==========================================
>   template<typename _Tp, bool __threads, int __inst>
>     struct _Alloc_traits<_Tp, MyAlloc_template<__threads, __inst> >
>     {
>       static const bool _S_instanceless = true;
>       typedef __simple_alloc<_Tp, MyAlloc_template<__threads, __inst>
>>
> _Alloc_type;
>       typedef __allocator<_Tp, MyAlloc_template<__threads, __inst> >
> allocator_type;
>     };
> ==========================================
> with gcc4 compatible code?

At first I would try to omit all that old stuff and use the defaults
everywhere. AFAIK names starting with underscore are not public, so it
was not wise to use them in the first place. If then there are
problems, e.g. performance problems, then I would reread the docs at
libstdc++ on gcc.gnu.org on allocators. Possibly there are some
features to support multithreaded apps.

I have some doubt that that allocator code can be easily ported to gcc4.
It possibly does access thread APIs which might have been improved
somewhat and I think allocators had quite some differences in their
semantics in gcc pre 3. Therefore better go back some steps and then
reintroduce new things as necessary.

Bernd Strieder




reply via email to

[Prev in Thread] Current Thread [Next in Thread]