Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2003-04-05 00:38:44

> > 2. Could type that implements swap() method somehow follow the second
> > road also? For example, could you somehow deduce T* from buffer and swap
> it
> > with local copy of the argument?
> Yes, I can look into such optimizations. But as I noted in previous
> messages, if I can prevent double-storage only for incomplete<T> (a point
> which I'm not certain is even true), it's probably not worthwhile. After
> all, sizeof(incomplete<T>) == sizeof(T*), so double-storage means
> 2*sizeof(T*).

So the tradeoff here is extra 4 bytes for the object size plus double
indirection for all access operations. Here the question arise then why not
use virtual function based solution then? I bet it will be incomparably more
simple to understand and probably easier to use.


Boost list run by bdawes at, gregod at, cpdaniel at, john at