Allowing arbitrary types for a function's argument and return type
    Kagamin via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Thu Oct 22 11:54:32 PDT 2015
    
    
  
On Thursday, 22 October 2015 at 15:10:58 UTC, pineapple wrote:
> What does if(isIntegral!T) do? It looks like it would verify 
> that the template type is a discrete number?
It doesn't verify, but filters: you can have several templates 
with the same name, when filter doesn't match, compiler tries 
another template. Maybe you can write collatzStep for string 
type, then this code wouldn't compile, because it doesn't make 
sense for strings. Remove the filter and the template will always 
compile with whatever it's supplied including BigNum as long as 
the code makes sense.
    
    
More information about the Digitalmars-d-learn
mailing list