Re: Template constraint: T is a value type

2014-10-30 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 29 October 2014 at 11:49:59 UTC, John Colvin wrote: On Wednesday, 29 October 2014 at 10:01:18 UTC, Gareth Foster wrote: Hi there, I'm looking to write a function template that operates only on value types. Basically I'm looking for an equivalent of where T: struct from C# (ht

Re: Template constraint: T is a value type

2014-10-29 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 29 October 2014 at 10:01:18 UTC, Gareth Foster wrote: Hi there, I'm looking to write a function template that operates only on value types. Basically I'm looking for an equivalent of where T: struct from C# (http://msdn.microsoft.com/en-us/library/d5x73970.aspx) I was thinki

Re: Template constraint: T is a value type

2014-10-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/10/2014 11:01 p.m., Gareth Foster wrote: Hi there, I'm looking to write a function template that operates only on value types. Basically I'm looking for an equivalent of where T: struct from C# (http://msdn.microsoft.com/en-us/library/d5x73970.aspx) I was thinking that maybe using

Template constraint: T is a value type

2014-10-29 Thread Gareth Foster via Digitalmars-d-learn
Hi there, I'm looking to write a function template that operates only on value types. Basically I'm looking for an equivalent of where T: struct from C# (http://msdn.microsoft.com/en-us/library/d5x73970.aspx) I was thinking that maybe using template Foo(T) if (is(T : struct) or is(T: un