www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Value Reference Type Traits

reply =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
Is there a trait to check if a type is a

- value type (struct, static array, etc)
- reference type (class, dynamic array, string, etc)

?
Jul 11 2014
parent reply "anonymous" <anonymous example.com> writes:
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.
Jul 11 2014
parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
On Friday, 11 July 2014 at 16:22:37 UTC, anonymous wrote:
 There's http://dlang.org/phobos/std_traits.html#hasIndirections
Thx.
Jul 12 2014