Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-04-05 22:32:38


Gennadiy Rozental wrote:
> > > 2. Could type that implements swap() method somehow follow the second
> case
> > > 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
> on
> > 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.

I'm not quite sure how virtual functions will solve anything, but I am eager
to understand if indeed they will.

Please explain.

Thanks,
Eric


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