Re: Simple template constraint question

2015-09-19 Thread anonymous via Digitalmars-d-learn
On Saturday 19 September 2015 19:09, WhatMeWorry wrote: > And a more open ended question. Is there a more elegant solution > for the > below function? Maybe a one-liner? I have a knack for making > simple solutions > complex :) > > > > // Calculate the number of components for openGL

Re: Simple template constraint question

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 19 September 2015 at 17:18:23 UTC, Daniel Kozak wrote: WhatMeWorry píše v So 19. 09. 2015 v 17:09 +: [...] http://dlang.org/expression.html#IsExpression 3. is ( Type == TypeSpecialization ) import std.stdio; struct S { } class C { } void f(T)(T someStruct) if (is (T ==

Re: Simple template constraint question

2015-09-19 Thread Daniel Kozak via Digitalmars-d-learn
WhatMeWorry píše v So 19. 09. 2015 v 17:09 +: > Does D provide complete template constraint granularity? > > In other words, I want to only accept structs in the template > below. > I've find the isAggregateType which is close but no cigar. Am I > missing > some other filters? > > And a

Simple template constraint question

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
Does D provide complete template constraint granularity? In other words, I want to only accept structs in the template below. I've find the isAggregateType which is close but no cigar. Am I missing some other filters? And a more open ended question. Is there a more elegant solution for