On 9/28/22 18:47, torhu via Digitalmars-d-learn wrote:
It works like writefln, so that example would not compile. I forgot to make the 
format string explicit, I probably should have done that.

```
private template _messageBox(string title, int style)
{
     void _messageBox(T...)(T args)
     {
         messageBox(format(args), title, style);
     }
}
```

If you want to pass a message, why bother with varargs? Wouldn't it be simpler 
to just accept a formatted string?

```d
import std;

void messageBox(string title, int style)(string msg) {
    guiMessageBox(msg, title, style);
}

alias info = messageBox!("Info", 4);
alias warn = messageBox!("Warning", 4);
alias err  = messageBox!("Error", 4);

void main() {
    info("ok ok");
    warn(5.iota.format!"%(%s, %)");
}
```

Reply via email to