simple (I think) eponymous template question ... what is proper idimatic way ?
james.p.leblanc
james.p.leblanc at gmail.com
Wed Aug 18 10:12:33 UTC 2021
On Wednesday, 18 August 2021 at 06:53:51 UTC, Tejas wrote:
> void funcTemplate(T:int)(T a){
> writeln("argument is int");
> }
>
> void funcTemplate(T : long)(T a){
> writeln("argument is long integer");
> }
>
> void main(){
> int a;
> long b;
> func(a);
> func(b);
>
> funcTemplate(a);
> funcTemplate(b);
>
> }
>
> ```
Domninikus, Tejas, and All,
I see that I had been (stupidly) omitting the exclamation point
after **"isIntegral"** in my clumsy attempts to use the traits ...
thanks for your clear example helping me identify my error.
Also, thanks for mentioning the words **"template
specialization"** , I did
not know what to call the use of **":"** in templates.
Now, I have a search term I can use to learn more ...and find it
is in Phillippe
Signaud's informative "D-templates-tutorial".
Thanks again,
James
PS Also, I am enjoying, a entertaining and educational tutorial
that Phillippe
has linked in his tutorial. Other may learn from this as well:
http://www.semitwist.com/articles/EfficientAndFlexible/SinglePage/
More information about the Digitalmars-d-learn
mailing list