On Friday, 11 September 2015 at 18:39:15 UTC, Ali Çehreli wrote:
>> import std.stdio;
>>
>> bool isEven(int n) {
>>     return !(n % 2);
>> }
>>
>> int readValidInt(alias validator)(string prompt) {

readValidInt() is a function template that takes two information:

1) The validator as its alias template parameter. alias template parameter allows it to work with anything that can be called.

I read "alias and with" chapter of the book to understand this but couldn't find any such use for `alias` there. Does using `alias` instead of a type makes the parameter a `callable`?

Reply via email to