Boost logo

Boost :

From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2007-06-13 21:16:57


Yigong Liu wrote:

> Thanks for the suggestions. Indeed i am thinking that maybe i should use
> vector<async<void(data)> &(*)> in the first place.

That would probably impose the use of dynamic allocation of each
channel, which would require memory management.
Following RAII, the vector should therefore own the pointees, so
ptr_vector should be used.

But if you think about it, there is no reason to impose stuff in a
vector to be copyable.
It's actually a design flaw in the Standard Library.

Stuff should be able to be constructed in-place in memory, without
needing temporaries which are then copied or moved to the contiguous
memory segment of the vector.

Copying, or rather moving, is only needed when growing (or shrinking,
but vector doesn't support that anyway).
But still, shouldn't channels be movable anyway?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk