How to declare a template type as parameter to functions
    Domingo via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Mon Nov  3 16:29:54 PST 2014
    
    
  
Thanks for the answer !
But then I can see that using D style templates everywhere will 
prevent write generic code and what seems to be an innocent 
function call will explode to bloated mass of code.
Like the "simple" function that I tried to write to not duplicate 
code is not worth because I'll need to write one for each type of 
MongoCursor:
1 - MongoCursor!(Bson, Bson, typeof(null))
2 - MongoCursor!(Bson, Bson, Bson)
3 - MongoCursor!(Bson, Bson, int[string])
protected void sendCollectionListAsDataArrayJson2(T)(T 
collection_list, HTTPServerResponse res)
What will be "T" on the function above ?
If I need to write one for each of then My intent of prevent 
duplicated code is dead.
The function only use code that should work on any combination of 
MongoCursor template.
To write less code I'll end up writing more code ?
Or are we missing something else here ?
    
    
More information about the Digitalmars-d-learn
mailing list