[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to allocate memory for a fixed size array
From: |
vfunc |
Subject: |
Re: How to allocate memory for a fixed size array |
Date: |
22 Sep 2006 15:29:57 -0700 |
User-agent: |
G2/1.0 |
Paul Pluzhnikov wrote:
> vfunc@talktalk.net writes:
>
> > How do I allocate memory for a large (10,000+) fixed size array ?
>
> Any way you wish:
>
> malloc(size);
> mmap(0, size, ... MAP_ANON, ...);
> std::vector<...> v(size);
>
> > In this case complexity is critical so I do not
> > want to use std:vector or some other dynamic structure.
>
> Come again?
I mean fixed (like an old school array) instead of dynamic like a
linked list, heap, skip list, etc, etc.. or whatever on earth
std::vector is equivalent to. See my post on comp.lang.c++, actually
don't bother.
Thanks your answer was succinct, although neither..
const size_t mysize = 10000;
typedef std::vector<f> fvec(mysize);
or
typedef std::vector<f> fvec;
class g
{
..
fvec f(mysize);
would compile for me.
Apologies for the off topic c++.