From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2003-10-08 15:34:24
At 20:18 2003-10-08, David Abrahams wrote:
>Daniel Wallin <dalwan01_at_[hidden]> writes:
> >>At that point, it might not contain any of the types you wanted. It almost
> >>becomes equivalent to a design Eric rejected, where the variant can be
> > I don't yet buy that this is a problem for generic programming;
> > If variant is part of the program interface, the type shouldn't be changed
> > anyway, so "wanting the benefit of the optimization" becomes the users
> > problem.
> > If the variant is part of the implementation, where the type
> > sequence is part of the interface, the invariant type is just an
I meant the state in which the variant ends up when an exception
is thrown in the assignment operator.
> > implementation detail, or part of the program documentation.
>Let me try again:
>- the variant design has a nice invariant that it contains one of the
> types that were passed as template arguments
>- if a library takes a user's list at face value, the library
> designer gets the benefit of that invariant.
>- if a library designer wants the optimization in the cases where
> it's possible, she either has to:
> - prepend empty_type to the list in order to ensure it, and give up
> on the nice invariant
I guess the problem is I can't really think of a situation where it makes
any difference if the variant contains the prepended empty_type or
a type from the original list. I'm guessing you can though, so please
help me understand.
--- Daniel Wallin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk