|
Boost : |
From: Eric Friedman (ebf_at_[hidden])
Date: 2002-08-09 23:23:47
Fernando Cacciola wrote:
[snip]
> IMO, since variant<> is essentially a compound type, exception-free
> assignment should be guaranteed by the types it contains, not by
> itself. We shouldn't except it to do more than whatever the types
> themselves do.
[snip]
> Also, the current implementation uses the copy-ctor in place of the
> assignment operator. This shouldn't be a problem, though, but unless
> *really* necessary, I wouldn't bypass T's operator=.
The reason the current code bypasses operator= is because a value of
type T must exist in variant's storage before assign can occur. So
without using copy-ctor, T must be default constructed and then
assigned -- not exactly a pretty picture, especially considering copy-
ctor is already required of variant bounded-types (and default-ctor
and assignment is not).
- Eric
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk