[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stl_alloc substitution
From: |
address@hidden |
Subject: |
Re: stl_alloc substitution |
Date: |
Mon, 9 Jun 2008 14:14:35 -0700 (PDT) |
User-agent: |
G2/1.0 |
On 9 Jun., 10:01, Bernd Strieder <strie...@informatik.uni-kl.de>
wrote:
> Hello,
>
>
>
> oliverp...@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
Thank you Bernd,
I am currently experimenting a bit with the STLPort libs. It includes
all the old templates. I will report back if I have luck with it.