|
Boost Users : |
Subject: Re: [Boost-users] [Review] Formal Review: Boost.Move
From: Neil Groves (neil_at_[hidden])
Date: 2010-05-24 14:14:08
On Mon, May 24, 2010 at 6:59 PM, John Dlugosz <JDlugosz_at_[hidden]>wrote:
> >
> > The problem is not downcasting, but the fact that T is not rv<T> (the
> > dynamic type of T is T, not rv<T>):
> >
>
> Reading the referenced article on C99 aliasing rules, perhaps what is
> needed is a alias_cast template that does it right (e.g. pass it through a
> union or use proper compiler-specific decorations).
>
>
That was my first thought too, but as far as I know all correct uses of a
union would mandate a fully copy of the T instance. I think that the
containment by pointer that was suggested by Steven Watanabe makes for a
nice solution.
If you have a novel solution that uses a union while avoiding assignment to
a new T instance I would be very interested.
Regards,
Neil Groves
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net