digitalmars.D - D lang newbie ..what does syntax func_name !() represent ??
- Andy Balba (6/6) Jul 24 2020 Hello forum
-
Adam D. Ruppe
(13/15)
Jul 24 2020
That's a template instance, like foo
in C++. - Andy Balba (2/11) Jul 24 2020 many thanks
- Mike Parker (2/8) Jul 24 2020 https://dlang.org/spec/template.html
- aberba (7/17) Jul 25 2020 Watched a video and they were also struggling to figure out what
Hello forum I'm a long-time C/C++ coder who recently completed the D lang on-line tour and want to improve my D lang savy. I keep running into statements like `func_name!()` and cant figure out what !() could possibly mean . Pz help, it's driving me nuts
Jul 24 2020
On Saturday, 25 July 2020 at 00:36:19 UTC, Andy Balba wrote:I keep running into statements like `func_name!()` and cant figure out what !() could possibly mean .That's a template instance, like foo<int> in C++. Though D can pass a lot more than just types to its templates so you might see like foo!"bar" too, but it is the same idea - passing that string as a template argument to foo. BTW if there is just one simple argument, you can leave the parentehsis out like I did there. to!int is the same as to!(int) which is like to<int> in C++.
Jul 24 2020
On Saturday, 25 July 2020 at 00:42:04 UTC, Adam D. Ruppe wrote:On Saturday, 25 July 2020 at 00:36:19 UTC, Andy Balba wrote:many thanksI keep running into statements like `func_name!()` and cant figure out what !() could possibly mean .That's a template instance, like foo<int> in C++. Though D can pass a lot more than just types to its templates so you might see like foo!"bar" too, but it is the same idea - passing that string as a template argument to foo. BTW if there is just one simple argument, you can leave the parentehsis out like I did there.
Jul 24 2020
On Saturday, 25 July 2020 at 00:36:19 UTC, Andy Balba wrote:Hello forum I'm a long-time C/C++ coder who recently completed the D lang on-line tour and want to improve my D lang savy. I keep running into statements like `func_name!()` and cant figure out what !() could possibly mean . Pz help, it's driving me nutshttps://dlang.org/spec/template.html
Jul 24 2020
On Saturday, 25 July 2020 at 01:23:18 UTC, Mike Parker wrote:On Saturday, 25 July 2020 at 00:36:19 UTC, Andy Balba wrote:Watched a video and they were also struggling to figure out what ! means as it's used right at the beginning. Could we highlight what the "!" mean? ...kind of like how Adam explained it? Especially when they've at that point not got to the templates section yet.Hello forum I'm a long-time C/C++ coder who recently completed the D lang on-line tour and want to improve my D lang savy. I keep running into statements like `func_name!()` and cant figure out what !() could possibly mean . Pz help, it's driving me nutshttps://dlang.org/spec/template.html
Jul 25 2020