[boost] Re: Re: Mini-review request: aligned_storage.hpp
by Itay Maman other posts by this author
Aug 9 2002 11:31AM messages near this date
RE: [boost] Re: Mini-review request: aligned_storage.hpp
|
Re: [boost] Re: Mini-review request: aligned_storage.hpp
Anthony Williams wrote in a message:
>
> I've just had a thought about how to implement the strong guarantee for
variant, at the expense of larger space requirements --- have *two* copies
of > the internals, with a flag to indicate which is valid. Then, when
swapping or assigning, copy construct the value from the other variant into
the unused > space, and destruct the original and switch the flag when
everything is done.
>
> What do people think?
>
> Anthony
>
I don't think it is possible - in the general case - to create two identical
instances of a class.
Consider this class:
// Just another class
struct jac
{
jac* inst_p_;
int n_;
jac(int n = 0) : n_(n)
{
inst_p_ = this;
}
jac(const jac& other) : n_(other.n_)
inst_p_ = this;
}
jac* get() { return inst_p_; }
void set(jac* inst_p) { inst_p_ = inst_p; }
} ;
--
Itay Maman
itay_maman@[...].com
maman@[...].com
This message expresses my personal opinion.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Fernando Cacciola
Eric Friedman
Fernando Cacciola
Douglas Gregor
Fernando Cacciola
Douglas Gregor
Itay Maman
David Abrahams
Eric Friedman
Itay Maman
Fernando Cacciola
David Abrahams
Eric Friedman
Douglas Gregor
|