Re: Value or Reference Semantics Trait

2014-01-13 Thread Orvid King
On 1/13/14, anonymous wrote: > On Monday, 13 January 2014 at 13:41:30 UTC, Orvid King wrote: >> If you just want to check if specifically it's a structure, you >> could >> always check `__traits(compiles, T()) && if(typeof(T()) == T)` >> beware >> however that this will evaluate to true if T is a

Re: Value or Reference Semantics Trait

2014-01-13 Thread anonymous
On Monday, 13 January 2014 at 13:41:30 UTC, Orvid King wrote: If you just want to check if specifically it's a structure, you could always check `__traits(compiles, T()) && if(typeof(T()) == T)` beware however that this will evaluate to true if T is a class with a static opCall who's return ty

Re: Value or Reference Semantics Trait

2014-01-13 Thread Dicebot
On Monday, 13 January 2014 at 13:41:30 UTC, Orvid King wrote: If you just want to check if specifically it's a structure, you could always check `__traits(compiles, T()) && if(typeof(T()) == T)` beware however that this will evaluate to true if T is a class with a static opCall who's return ty

Re: Value or Reference Semantics Trait

2014-01-13 Thread Orvid King
If you just want to check if specifically it's a structure, you could always check `__traits(compiles, T()) && if(typeof(T()) == T)` beware however that this will evaluate to true if T is a class with a static opCall who's return type is T. On 1/13/14, Tobias Pankrath wrote: > On Sunday, 12 Janua

Re: Value or Reference Semantics Trait

2014-01-13 Thread Tobias Pankrath
On Sunday, 12 January 2014 at 20:16:15 UTC, Nordlöw wrote: Is there a trait to check whether a type has value or reference semantics? I need this in a template struct that adaptively (using static if) represent histogram bins as either a dense static array or a sparse associative array. Add

Re: Value or Reference Semantics Trait

2014-01-13 Thread John Colvin
On Sunday, 12 January 2014 at 20:16:15 UTC, Nordlöw wrote: Is there a trait to check whether a type has value or reference semantics? I need this in a template struct that adaptively (using static if) represent histogram bins as either a dense static array or a sparse associative array. Tha

Re: Value or Reference Semantics Trait

2014-01-13 Thread qznc
On Sunday, 12 January 2014 at 20:16:15 UTC, Nordlöw wrote: Is there a trait to check whether a type has value or reference semantics? I need this in a template struct that adaptively (using static if) represent histogram bins as either a dense static array or a sparse associative array. No,