Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-08-11 03:42:07


At Friday 2002/08/09 10:02, you wrote:
>On Friday 09 August 2002 01:31 pm, Itay Maman wrote:
> > >Obviously, you need to account for alignment, and with variant it is a bit
> >
> > more complex in the
> >
> > >implementation due to the multiple types, but the idea is the same.
> > >
> > >Also, if you want assignment to actually perform assignment on the
> >
> > underlying type, rather than
> >
> > >just transfer the value into the variant, then things are more
> > > complicated.
> > >
> > >Anthony
> >
> > Seems like a very reasonable compromise. I am certainly in favor of this
> > trick.
> > Anyway, this complicates the issue of safety vs. speed vs. sapce even
> > further.
> >
> > Eric, Doug comments?
>
>I think it's interesting to note that this trick could come "for free" if
>there is a large type that can always be swapped/assigned giving the strong
>guarantee and a smaller type that doesn't have such properties. For instance:
>
> variant<double[5], crazy_type> v;
>
>where crazy_type is a type with strange behavior, but whose size is less than
>the size of 2 doubles.

I don't believe that a simple exchange of bits over sizeof(object) is
sufficient in all cases to perform a swap.

> Doug
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Victor A. Wagner Jr. http://rudbek.com
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"


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