"Ronald Garcia" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hi,
>
> In reading through the variant docs, I noticed a requirement that at least
> two types must be supported by the variant.  Is this meant for ease of
> library implementation, or is this a means of protecting programmers from
> themselves? :-)
>

The latter: The rationale was that a developer is better off with handling a
single value directly, rather than wrapping it inside a variant.

> It may not make sense for a human programmer to instantiate a variant
> with one value in it, but I can picture situations where a code generator
> might create a variant of only one type.  Handling this as a
> special case can be tedious -- I have had related problems in the past
> generating structs of zero elements in C. Even when a human programmer is
> involved, one might prefer the clarity of a consistent implementation
> style over the performance gain of special casing. These situations might
> be worth considering.
>

I agree with you. This is all about sound "code engineering": A mechanism
may start with a single type but may need to support more and more types as
time go by. As it stands now, you will have to start with two types.

This is a good point. Thanks.

--
Itay Maman
    [EMAIL PROTECTED]
    [EMAIL PROTECTED]

This message expresses my personal opinion.






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

Reply via email to