Value Reference Type Traits

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 11 09:22:37 PDT 2014


On Friday, 11 July 2014 at 16:10:31 UTC, Nordlöw wrote:
> Is there a trait to check if a type is a
>
> - value type (struct, static array, etc)
> - reference type (class, dynamic array, string, etc)
>
> ?

There's http://dlang.org/phobos/std_traits.html#hasIndirections

Note that structs and static arrays may contain indirections,
i.e. they are not guaranteed to have value semantics all the way
down. Primitive types like int or float are definite values types.


More information about the Digitalmars-d-learn mailing list