|
Boost : |
From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2006-02-07 14:55:22
On 2/7/06, Giovanni Piero Deretta <gpderetta_at_[hidden]> wrote:
> On 2/7/06, Giovanni P. Deretta <gpderetta_at_[hidden]> wrote:
> >
> >
> > Ah, btw, at least on posix systems, file descriptors are guaranteed to
> > be allocated contiguously. So you could create a vector as big as the
> > hightest fd, store the list of operations in it and use the socket_impl
> > as a key for an O(1) lookup in the vector.
>
> This is not true of course... I don't know what i was thinking...
> Anyway, a file descriptor is *usually* a small integer, so on those systems
> that keep the set mostly contiguous a vector would work and not waste much
> space.
Why is not true? I think you were right. Although *all* file
descriptors are contiguously, which means that other parts of the
program may create "holes" in the vector. But it would work alright (I
think ACE does this on Posix systems).
-- Felipe Magno de Almeida
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk