Re: Make function alias

2018-08-20 Thread Basile B. via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote: Hello, I want to make an alias to function "std.stdio.writeln" and "std.stdio.write" and use it like: static void log(bool newline = true)(string text) { alias print(T...) = newline ? : _file.print(); text.print(); }

Re: Make function alias

2018-08-20 Thread Andrey via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:35:07 UTC, ag0aep6g wrote: On 08/20/2018 03:14 PM, Andrey wrote: Thanks everybody for your answers.

Re: Make function alias

2018-08-20 Thread ag0aep6g via Digitalmars-d-learn
On 08/20/2018 03:14 PM, Andrey wrote: Hello, I want to make an alias to function "std.stdio.writeln" and "std.stdio.write" and use it like: static void log(bool newline = true)(string text) {    alias print(T...) = newline ? :    _file.print();    text.print(); } Unfortunately, it

Re: Make function alias

2018-08-20 Thread Paul Backus via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote: Hello, I want to make an alias to function "std.stdio.writeln" and "std.stdio.write" and use it like: static void log(bool newline = true)(string text) { alias print(T...) = newline ? : _file.print(); text.print(); }

Re: Make function alias

2018-08-20 Thread vit via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:22:02 UTC, Andrey wrote: On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote: Mistake... this is: static void log(bool newline = true)(string text) { alias print(T...) = newline ? : _file.print(text); text.print(); } static void log(bool newline

Re: Make function alias

2018-08-20 Thread Andrey via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote: Mistake... this is: static void log(bool newline = true)(string text) { alias print(T...) = newline ? : _file.print(text); text.print(); }