NULL indicator in Variant

Alex Rønne Petersen xtzgzorex at gmail.com
Thu Oct 27 07:18:01 PDT 2011


On 27-10-2011 15:54, Steve Teale wrote:
>>
>> I'm not sure having three possible states in Variant is a good idea, but
>> maybe I'm not quite following.
>>
>> Doesn't it already carry type information when not set to a value?
>>
>> - Alex
>
> Don't believe so. If you haven't set any value, hasValue() will return
> false, so it is kind of null, and it is not associated with a type - how
> would it know?
>
> Steve
>

You're completely right; brain failed me for a moment there.

OK, so I think introducing a constructor (or something like that) taking 
a TypeInfo object is a reasonable approach to setting it to no value, 
but still carrying a type.

- Alex


More information about the Digitalmars-d mailing list