sumtype 1.0.0

Paul Backus snarwin at
Tue Nov 24 22:26:34 UTC 2020

On Tuesday, 24 November 2020 at 21:52:47 UTC, Dibyendu Majumdar 
> On Sunday, 15 November 2020 at 20:05:16 UTC, Paul Backus wrote:
>> SumType is a generic discriminated union type for modern D. It 
>> is designed to
>> be an improved alternative to `std.variant.Algebraic`.
> Nice. Is it possible to describe how these types are 
> represented in memory? Anyone who uses unions and wants to use 
> these would want to know whether these types are laid out like 
> unions or not. What is the size of the type - is it equal to 
> the largest member?

SumType uses a union internally, so the types all share the same 
memory. The size of the SumType is equal to the size of the union 
plus the size of the tag (plus padding, if necessary).

More information about the Digitalmars-d-announce mailing list